Do not skip pruning identities inserted by Grappler in dependency optimizer.
PiperOrigin-RevId: 236370572
This commit is contained in:
parent
0afe41679f
commit
8fa58e7762
@ -75,16 +75,8 @@ bool DependencyOptimizer::SafeToRemoveIdentity(const NodeDef& node) const {
|
|||||||
// Recv.
|
// Recv.
|
||||||
if (IsVariable(*input) || IsRecv(*input)) {
|
if (IsVariable(*input) || IsRecv(*input)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (IsSwitch(*input)) {
|
|
||||||
// Don't turn Identity nodes following Switch into NoOp or remove them
|
|
||||||
// if it requires anchoring a control dependencies the Switch node, which
|
|
||||||
// is not valid.
|
|
||||||
if (str_util::StartsWith(node.name(), kConstantFoldingCtrl)) {
|
|
||||||
// TODO(rmlarsen): Try to remove this artificial contraint.
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
for (const auto& consumer : node_map_->GetOutputs(node.name())) {
|
||||||
for (auto consumer : node_map_->GetOutputs(node.name())) {
|
|
||||||
if (node.input_size() > 1 && IsMerge(*consumer)) {
|
if (node.input_size() > 1 && IsMerge(*consumer)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user