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

Method AddControlEdge

tensorflow/core/graph/graph.cc:542–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

540}
541
542const Edge* Graph::AddControlEdge(Node* source, Node* dest,
543 bool allow_duplicates) {
544 if (!allow_duplicates) {
545 for (const Edge* edge : dest->in_edges()) {
546 if (edge->IsControlEdge() && edge->src() == source) {
547 // The requested edge already exists.
548 return nullptr;
549 }
550 }
551 }
552 // Modify dest's NodeDef if necessary.
553 if (!source->IsSource() && !dest->IsSink() && !allow_duplicates) {
554 // Check if this input is already in dest's NodeDef.
555 const string new_input = strings::StrCat("^", source->name());
556 bool input_exists = false;
557 for (const string& input : dest->props_->node_def.input()) {
558 if (input == new_input) {
559 input_exists = true;
560 break;
561 }
562 }
563 if (!input_exists) {
564 dest->MaybeCopyOnWrite();
565 dest->props_->node_def.add_input(new_input);
566 }
567 }
568 return AddEdge(source, kControlSlot, dest, kControlSlot);
569}
570
571void Graph::RemoveControlEdge(const Edge* e) {
572 if (!e->src_->IsSource() && !e->dst_->IsSink()) {

Callers 15

AddStrictInputSemanticsFunction · 0.45
AddInputsMethod · 0.45
AddOutputsMethod · 0.45
AddInputsMethod · 0.45
AddOutputsMethod · 0.45
TEST_FFunction · 0.45
CreateEnterNodesMethod · 0.45
UpdateConsumersMethod · 0.45

Calls 9

IsSourceMethod · 0.80
IsSinkMethod · 0.80
MaybeCopyOnWriteMethod · 0.80
nameMethod · 0.65
StrCatFunction · 0.50
IsControlEdgeMethod · 0.45
srcMethod · 0.45
inputMethod · 0.45
add_inputMethod · 0.45

Tested by 10

TEST_FFunction · 0.36
BuildConcurrentAddAssignFunction · 0.36
TEST_FFunction · 0.36
TESTFunction · 0.36
ManyConstsFunction · 0.36
TransferFileFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TESTFunction · 0.36