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

Function RewriteCaseNode

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

Source from the content-addressed store, hash-verified

269} // namespace
270
271Status RewriteCaseNode(Node* n, Graph* g, bool keep_node_fetchable) {
272 VLOG(2) << "Lower Case node (keep_node_fetchable=" << keep_node_fetchable
273 << "): " << SummarizeNode(*n);
274 const AttrValue* branches_attr = n->attrs().Find("branches");
275 if (branches_attr == nullptr) {
276 return errors::InvalidArgument("branch functions missing");
277 }
278
279 int num_branches = branches_attr->list().func_size();
280 std::vector<string> branch_fn_names;
281 branch_fn_names.reserve(num_branches);
282 for (int b = 0; b < num_branches; b++) {
283 branch_fn_names.emplace_back(branches_attr->list().func(b).name());
284 }
285 CaseBuilder cb(n, branch_fn_names, keep_node_fetchable, 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 13

InvalidArgumentFunction · 0.85
listMethod · 0.80
nameMethod · 0.65
SummarizeNodeFunction · 0.50
FindMethod · 0.45
attrsMethod · 0.45
reserveMethod · 0.45
emplace_backMethod · 0.45
funcMethod · 0.45
CreatePivotNodesMethod · 0.45
AddInputsMethod · 0.45
AddOutputsMethod · 0.45

Tested by

no test coverage detected