Update a comment why terimnate op should be skipped in While op

canonicalization

PiperOrigin-RevId: 351878286
Change-Id: I42707904a8b188e2f64a7bb3825322b44f13d1cc
This commit is contained in:
Jaesung Chung 2021-01-14 14:32:46 -08:00 committed by TensorFlower Gardener
parent 51d0e14e15
commit e97de5bfd7

View File

@ -2487,7 +2487,10 @@ struct WhileResultOperandsMatchAndImplicitCapture
if (getElementTypeOrSelf(ba.getType()).isa<TF::ResourceType>()) {
bool has_read_only_variables = true;
for (auto user : ba.getUsers()) {
// Ternimator ops, for example, tfl::yield op, should be ignored.
// Ternimator ops, for example, tfl::yield op, should be ignored since
// the argument can be used for yielding as the `body` function result
// and that does not give any meaningful points to the decision
// whether the given arugment is a read-only variable or not.
if (user->hasTrait<OpTrait::IsTerminator>()) continue;
if (!llvm::isa<mlir::TF::ReadVariableOp>(user)) {
has_read_only_variables = false;