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

Function GetReadyNodes

tensorflow/core/graph/graph_partition.cc:1679–1714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1677namespace {
1678
1679void GetReadyNodes(std::unordered_set<Node*>& done,
1680 const std::string& loc,
1681 std::unordered_set<Node*>* node_set,
1682 std::unordered_map<std::string, std::unordered_set<Node*> >* ready_nodes) {
1683 bool exit = false;
1684 while (!exit && node_set->size() > 0) {
1685 exit = true;
1686 for (auto n : *node_set) {
1687 if (!n->IsOp()) {
1688 LOG(FATAL) << "There should be no _Source or _Sink here.";
1689 }
1690
1691 bool ready = true;
1692 for (const Edge* in_edge : n->in_edges()) {
1693 Node* src = in_edge->src();
1694 if (!src->IsOp()) continue;
1695 // NOTE(jiankeng.pt): skip NextIteration to make topological sort successful.
1696 if (n->IsMerge() && src->IsNextIteration()) {
1697 continue;
1698 }
1699 if (done.find(src) != done.end()) continue;
1700 // (*ready_nodes)[loc].find(src) != (*ready_nodes)[loc].end()
1701 ready = false;
1702 break;
1703 }
1704 if (ready) {
1705 exit = false;
1706 (*ready_nodes)[loc].insert(n);
1707 }
1708 }
1709
1710 for (auto n : (*ready_nodes)[loc]) {
1711 node_set->erase(n);
1712 }
1713 }
1714}
1715
1716} // namespace
1717

Callers 1

PartitionWithTensorFuseFunction · 0.85

Calls 9

IsOpMethod · 0.80
IsMergeMethod · 0.80
IsNextIterationMethod · 0.80
sizeMethod · 0.45
srcMethod · 0.45
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected