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

Function BackwardDFS

tensorflow/compiler/jit/graphcycles/graphcycles.cc:229–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229static void BackwardDFS(GraphCycles::Rep* r, int32 n, int32 lower_bound) {
230 r->deltab_.clear();
231 r->stack_.clear();
232 r->stack_.push_back(n);
233 while (!r->stack_.empty()) {
234 n = r->stack_.back();
235 r->stack_.pop_back();
236 Node* nn = r->nodes_[n];
237 if (nn->visited) continue;
238
239 nn->visited = true;
240 r->deltab_.push_back(n);
241
242 for (auto w : nn->in.GetSequence()) {
243 Node* nw = r->nodes_[w];
244 if (!nw->visited && lower_bound < nw->rank) {
245 r->stack_.push_back(w);
246 }
247 }
248 }
249}
250
251static void Reorder(GraphCycles::Rep* r) {
252 Sort(r->nodes_, &r->deltab_);

Callers 1

InsertEdgeMethod · 0.85

Calls 6

pop_backMethod · 0.80
GetSequenceMethod · 0.80
clearMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected