[grappler] Do not forward inputs to _Retval nodes

PiperOrigin-RevId: 353903299
Change-Id: Ic1397f68555efdd7c7a4a2bf429589ef49cc2dea
This commit is contained in:
Eugene Zhulenev 2021-01-26 10:58:46 -08:00 committed by TensorFlower Gardener
parent c0948d3b29
commit 8e985babf8

View File

@ -285,6 +285,11 @@ bool ConstantFolding::ForwardInputs(NodeDef* node,
if (IsControlInput(consumer_input)) {
break;
}
// It is illegal to add control dependencies to _Retval nodes, so we
// can't bypass value producing `node` and forward inputs to `consumer`.
if (IsRetval(*consumer)) {
break;
}
int output_idx;
const string input_node_name =
ParseNodeName(consumer_input, &output_idx);