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

Function InitializePending

tensorflow/core/distributed_runtime/scheduler.cc:30–49  ·  view source on GitHub ↗

Initialize the pending count for each node.

Source from the content-addressed store, hash-verified

28
29// Initialize the pending count for each node.
30void InitializePending(const Graph* graph, std::vector<int>* pending) {
31 pending->resize(graph->num_node_ids());
32 for (const Node* node : graph->nodes()) {
33 const int id = node->id();
34 int num_in_edges = 0;
35 if (IsMerge(node)) {
36 // For forward execution order, Merge nodes are special. We process
37 // them only once when one of its inputs is processed.
38 for (const Edge* edge : node->in_edges()) {
39 if (edge->IsControlEdge()) {
40 // Bit 0 is reserved to indicate if there is a data input.
41 num_in_edges += 2;
42 }
43 }
44 } else {
45 num_in_edges = node->in_edges().size();
46 }
47 (*pending)[id] = num_in_edges;
48 }
49}
50
51// Return true if the update makes the destination of the edge ready to run.
52bool UpdatePending(const Edge* edge, std::vector<int>* pending_count) {

Callers 3

InitializeMethod · 0.85
ComputeAsapMethod · 0.85
ComputeScheduleMethod · 0.85

Calls 7

IsMergeFunction · 0.50
resizeMethod · 0.45
num_node_idsMethod · 0.45
nodesMethod · 0.45
idMethod · 0.45
IsControlEdgeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected