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

Function MarkComputeGraph

tensorflow/core/graph/graph_util.cc:26–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25namespace {
26void MarkComputeGraph(const Graph* g, std::vector<bool>& is_var_relate) {
27 // Get the starting node of the coloring algorithm
28 std::queue<const Node*> q;
29 for (Node* n : g->op_nodes()) {
30 if (n->IsVariable() || n->IsKvVarHandle()
31 || n->IsControlFlow()
32 || n->type_string() == "VarHandleOp") {
33 q.emplace(n);
34 }
35 }
36
37 // mark compute graph node
38 while (!q.empty()) {
39 const Node* node = q.front();
40 q.pop();
41 is_var_relate[node->id()] = true;
42 for (auto e : node->out_edges()) {
43 if (!is_var_relate[e->dst()->id()]) {
44 q.emplace(e->dst());
45 }
46 }
47 }
48}
49
50void DealWithNode(Graph* g, Node* n,
51 const std::vector<bool>& is_var_relate,

Calls 10

op_nodesMethod · 0.80
IsVariableMethod · 0.80
IsKvVarHandleMethod · 0.80
IsControlFlowMethod · 0.80
emplaceMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
popMethod · 0.45
idMethod · 0.45
dstMethod · 0.45

Tested by

no test coverage detected