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

Method PrintCycles

tensorflow/core/graph/graph_constructor.cc:1079–1097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1077}
1078
1079void GraphConstructor::PrintCycles() {
1080 int num_nodes = outputs_.size();
1081 absl::flat_hash_set<int> unvisited;
1082 for (int i = 0; i < num_nodes; i++) {
1083 unvisited.insert(i);
1084 }
1085 while (!unvisited.empty()) {
1086 int cur_node = *unvisited.begin();
1087 // Nodes on the current branch of DFS in traversal order. This is used for
1088 // printing the nodes in the cycle.
1089 std::vector<int> cur_branch;
1090 // This is just to make lookups O(1).
1091 // is_on_cur_branch[i] ==
1092 // (std::find(cur_branch.start(),
1093 // cur_branch.end(), i) != cur_branch.end())
1094 std::vector<bool> is_on_cur_branch(num_nodes, false);
1095 DFS(cur_node, &cur_branch, &is_on_cur_branch, &unvisited);
1096 }
1097}
1098
1099Status GraphConstructor::Convert() {
1100 // Import functions before adding nodes, since imported nodes may refer to

Callers

nothing calls this directly

Calls 5

DFSFunction · 0.85
sizeMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected