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

Method AddWhileInputHack

tensorflow/core/graph/graph.cc:612–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610}
611
612Status Graph::AddWhileInputHack(Node* new_src, int new_src_index, Node* dst) {
613 if (!dst->IsWhileNode()) {
614 return errors::Internal(
615 "dst argument to AddWhileEdgeHack should be a While op, got: ",
616 dst->DebugString());
617 }
618 TF_RETURN_IF_ERROR(IsValidOutputTensor(new_src, new_src_index));
619 // Find the current number of data inputs. We'll add the new edge to the next
620 // missing data input.
621 int dst_index = 0;
622 for (const Edge* edge : dst->in_edges()) {
623 if (edge->IsControlEdge()) continue;
624 ++dst_index;
625 }
626 TF_RETURN_IF_ERROR(IsValidInputTensor(dst, dst_index));
627 AddEdge(new_src, new_src_index, dst, dst_index);
628 dst->MaybeCopyOnWrite();
629 dst->props_->node_def.add_input(
630 strings::StrCat(new_src->name(), ":", new_src_index));
631 return Status::OK();
632}
633
634Status Graph::AddFunctionLibrary(const FunctionDefLibrary& fdef_lib) {
635 // Need a new-enough consumer to support the functions we add to the graph.

Callers 2

_add_while_inputsMethod · 0.80
AddWhileInputHackFunction · 0.80

Calls 8

InternalFunction · 0.85
IsWhileNodeMethod · 0.80
MaybeCopyOnWriteMethod · 0.80
nameMethod · 0.65
StrCatFunction · 0.50
DebugStringMethod · 0.45
IsControlEdgeMethod · 0.45
add_inputMethod · 0.45

Tested by

no test coverage detected