MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / RewriteIfNode

Function RewriteIfNode

tensorflow/core/common_runtime/lower_if_op.cc:271–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269} // namespace
270
271Status RewriteIfNode(Node* n, Graph* g, bool keep_node_fetchable) {
272 VLOG(2) << "Lower If node (keep_node_fetchable=" << keep_node_fetchable
273 << "): " << SummarizeNode(*n);
274
275 const AttrValue* then_attr = n->attrs().Find("then_branch");
276 if (then_attr == nullptr) {
277 return errors::InvalidArgument("Then branch function missing");
278 }
279 const AttrValue* else_attr = n->attrs().Find("else_branch");
280 if (else_attr == nullptr) {
281 return errors::InvalidArgument("Else branch function missing");
282 }
283
284 CondBuilder cb(n, then_attr->func(), else_attr->func(), keep_node_fetchable,
285 g);
286 TF_RETURN_IF_ERROR(cb.CreatePivotNodes());
287 TF_RETURN_IF_ERROR(cb.AddInputs());
288 TF_RETURN_IF_ERROR(cb.AddOutputs());
289 g->RemoveNode(n);
290
291 return Status::OK();
292}
293
294} // namespace tensorflow

Callers 2

InlineFunctionCallsFunction · 0.85
RunMethod · 0.85

Calls 9

InvalidArgumentFunction · 0.85
SummarizeNodeFunction · 0.50
FindMethod · 0.45
attrsMethod · 0.45
funcMethod · 0.45
CreatePivotNodesMethod · 0.45
AddInputsMethod · 0.45
AddOutputsMethod · 0.45
RemoveNodeMethod · 0.45

Tested by

no test coverage detected