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

Method NewNode

tensorflow/compiler/jit/graphcycles/graphcycles.cc:111–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111int32 GraphCycles::NewNode() {
112 if (rep_->free_nodes_.empty()) {
113 Node* n = new Node;
114 n->visited = false;
115 n->data = nullptr;
116 n->rank = rep_->nodes_.size();
117 rep_->nodes_.push_back(n);
118 return n->rank;
119 } else {
120 // Preserve preceding rank since the set of ranks in use must be
121 // a permutation of [0,rep_->nodes_.size()-1].
122 int32 r = rep_->free_nodes_.back();
123 rep_->nodes_[r]->data = nullptr;
124 rep_->free_nodes_.pop_back();
125 return r;
126 }
127}
128
129void GraphCycles::RemoveNode(int32 node) {
130 Node* x = rep_->nodes_[node];

Callers 4

TESTFunction · 0.45
GraphCyclesTestMethod · 0.45
BM_StressTestFunction · 0.45

Calls 5

pop_backMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45

Tested by 3

TESTFunction · 0.36
GraphCyclesTestMethod · 0.36
BM_StressTestFunction · 0.36