[Grappler] Do not add control edges from placeholder inputs in function inlining
PiperOrigin-RevId: 311412339 Change-Id: Ie40c0c44f1d6b42b53c259f8ad92d171577cd9c7
This commit is contained in:
parent
4eeb6d742e
commit
7e39134874
@ -1122,7 +1122,15 @@ void AddStrictInputSemantics(Node* caller, Graph* g) {
|
|||||||
|
|
||||||
VLOG(3) << "Add control edges from all data inputs to enforce strict "
|
VLOG(3) << "Add control edges from all data inputs to enforce strict "
|
||||||
"semantics with regard to function inputs";
|
"semantics with regard to function inputs";
|
||||||
|
|
||||||
|
// Do not add control edges from placeholders, because it will prevent
|
||||||
|
// pruning, and they can't produce any side effects anyway.
|
||||||
|
const auto is_placeholder = [](const Node* node) -> bool {
|
||||||
|
return node->type_string() == "Placeholder";
|
||||||
|
};
|
||||||
|
|
||||||
for (const Node* node : data_inputs) {
|
for (const Node* node : data_inputs) {
|
||||||
|
if (is_placeholder(node)) continue;
|
||||||
g->AddControlEdge(g->FindNodeId(node->id()), caller,
|
g->AddControlEdge(g->FindNodeId(node->id()), caller,
|
||||||
/*allow_duplicates=*/true);
|
/*allow_duplicates=*/true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user