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

Method CheckInvariants

tensorflow/compiler/jit/graphcycles/graphcycles.cc:89–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89bool GraphCycles::CheckInvariants() const {
90 Rep* r = rep_;
91 NodeSet ranks; // Set of ranks seen so far.
92 for (Vec<Node*>::size_type x = 0; x < r->nodes_.size(); x++) {
93 Node* nx = r->nodes_[x];
94 if (nx->visited) {
95 LOG(FATAL) << "Did not clear visited marker on node " << x;
96 }
97 if (!ranks.insert(nx->rank).second) {
98 LOG(FATAL) << "Duplicate occurrence of rank " << nx->rank;
99 }
100 for (int32 y : nx->out.GetSequence()) {
101 Node* ny = r->nodes_[y];
102 if (nx->rank >= ny->rank) {
103 LOG(FATAL) << "Edge " << x << "->" << y << " has bad rank assignment "
104 << nx->rank << "->" << ny->rank;
105 }
106 }
107 }
108 return true;
109}
110
111int32 GraphCycles::NewNode() {
112 if (rep_->free_nodes_.empty()) {

Callers 4

TESTFunction · 0.45
GraphCyclesTestMethod · 0.45
AddMultiplesMethod · 0.45
TEST_FFunction · 0.45

Calls 3

GetSequenceMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45

Tested by 4

TESTFunction · 0.36
GraphCyclesTestMethod · 0.36
AddMultiplesMethod · 0.36
TEST_FFunction · 0.36