tensorflow/compiler/tf2xla/rearrange_function_argument.cc
// Given mapping between original output index and rearranged output index,
// change "index" attribute for _Retval nodes. Notice that DT_RESOURCE _Retval
// nodes will be removed.
Given mapping between original output index and rearranged output index,
change "index" attribute for _Retval nodes. Notice that DT_RESOURCE _Retval
nodes will be removed.
Given mapping between original output index and rearranged output index change " index " attribute for _Retval nodes . Notice that DT_RESOURCE _Retval nodes will be removed .
void RearrangeRetvalNodes(
    const gtl::InlinedVector<Node*, 4>& ret_nodes,  
    Graph* g, const std::map<int, int>& retval_index_mapping) {
  for (int i = 0, end = ret_nodes.size(); i < end; i++) {
    Node* n = ret_nodes[i];
    auto iter = retval_index_mapping.find(i);
    if (iter == retval_index_mapping.end()) {
      g->RemoveNode(n);
    } else {
      n->ClearAttr("index");
      n->AddAttr("index", iter->second);
    }
  }
}
void RearrangeRetvalNodes ( const gtl :: InlinedVector < Node * , 4 > & ret_nodes , Graph * g , const std :: map < int , int > & retval_index_mapping ) { for ( int i = 0 , end = ret_nodes . size ( ) ; i < end ; i ++ ) { Node * n = ret_nodes [ i ] ; auto iter = retval_index_mapping . find ( i ) ; if ( iter == retval_index_mapping . end ( ) ) { g -> RemoveNode ( n ) ; } else { n -> ClearAttr ( " " ) ; n -> AddAttr ( " " , iter -> second ) ; } } }
Given mapping between original output index and rearranged output index,
change "index" attribute for _Retval nodes.
Given mapping between original output index and rearranged output index change " index " attribute for _Retval nodes .
// non-absl ok