tensorflow/compiler/tf2xla/rearrange_function_argument_pass.cc
// Given mapping between original input index and rearranged input index,
// reorder input edges for the node.
Given mapping between original input index and rearranged input index,
reorder input edges for the node.
Given mapping between original input index and rearranged input index reorder input edges for the node .
Status ReorderInputEdges(Graph* g, Node* n,
                         const std::vector<int>& index_mapping) {
  std::vector<const Edge*> input_edges;
  for (const Edge* e : n->in_edges()) {
    if (e->IsControlEdge()) {
      continue;
    }
    input_edges.push_back(e);
  }
  for (const Edge* e : input_edges) {
    Node* src = e->src();
    int src_output = e->src_output();
    int dst_input = e->dst_input();
    int new_dst_input = index_mapping.at(dst_input);
    g->RemoveEdge(e);
    g->AddEdge(src, src_output, n, new_dst_input)->DebugString();
  }
  return Status::OK();
}
Status ReorderInputEdges ( Graph * g , Node * n , const std :: vector < int > & index_mapping ) { std :: vector < const Edge * > input_edges ; for ( const Edge * e : n -> in_edges ( ) ) { if ( e -> IsControlEdge ( ) ) { continue ; } input_edges . push_back ( e ) ; } for ( const Edge * e : input_edges ) { Node * src = e -> src ( ) ; int src_output = e -> src_output ( ) ; int dst_input = e -> dst_input ( ) ; int new_dst_input = index_mapping . at ( dst_input ) ; g -> RemoveEdge ( e ) ; g -> AddEdge ( src , src_output , n , new_dst_input ) -> DebugString ( ) ; } return Status :: OK ( ) ; }
Given mapping between original input index and rearranged input index,
reorder input edges for the node.
Given mapping between original input index and rearranged input index reorder input edges for the node .