tensorflow/core/distributed_runtime/scheduler.cc
// Initialize the pending count for each node.
Initialize the pending count for each node.
Initialize the pending count for each node .
void InitializePending(const Graph* graph, std::vector<int>* pending) {
  pending->resize(graph->num_node_ids());
  for (const Node* node : graph->nodes()) {
    const int id = node->id();
    int num_in_edges = 0;
    if (IsMerge(node)) {
      for (const Edge* edge : node->in_edges()) {
        if (edge->IsControlEdge()) {
          num_in_edges += 2;
        }
      }
    } else {
      num_in_edges = node->in_edges().size();
    }
    (*pending)[id] = num_in_edges;
  }
}
void InitializePending ( const Graph * graph , std :: vector < int > * pending ) { pending -> resize ( graph -> num_node_ids ( ) ) ; for ( const Node * node : graph -> nodes ( ) ) { const int id = node -> id ( ) ; int num_in_edges = 0 ; if ( IsMerge ( node ) ) { for ( const Edge * edge : node -> in_edges ( ) ) { if ( edge -> IsControlEdge ( ) ) { num_in_edges += 2 ; } } } else { num_in_edges = node -> in_edges ( ) . size ( ) ; } ( * pending ) [ id ] = num_in_edges ; } }
Initialize the pending count for each node.
Initialize the pending count for each node .
// For forward execution order, Merge nodes are special. We process // them only once when one of its inputs is processed. // Bit 0 is reserved to indicate if there is a data input.