tensorflow/core/grappler/optimizers/data/fusion_utils.cc
// We need to rename them and the connections of the inputs that refer to them.
// Nodes that will be added to the function can have the same name as the nodes
// from parent function.
We need to rename them and the connections of the inputs that refer to them.
Nodes that will be added to the function can have the same name as the nodes
from parent function.
We need to rename them and the connections of the inputs that refer to them . Nodes that will be added to the function can have the same name as the nodes from parent function .
void RenameFunctionNodes(const FunctionDef& first_function,
                         protobuf::RepeatedPtrField<NodeDef>* nodes_to_fuse,
                         protobuf::Map<string, string>* rets_to_fuse) {
  const gtl::FlatMap<string, string> changed_node_names =
      GetUniqueNames(first_function.node_def(), *nodes_to_fuse);
  auto update_name = [&changed_node_names](string* input) {
    string input_node = ParseNodeConnection(*input);
    auto iter = changed_node_names.find(input_node);
    if (iter != changed_node_names.end()) {
      *input = iter->second + ParseOutputNode(*input);
    }
  };
  for (NodeDef& function_node : *nodes_to_fuse) {
    if (const string* new_name =
            gtl::FindOrNull(changed_node_names, function_node.name())) {
      function_node.set_name(*new_name);
    }
    for (string& input : *function_node.mutable_input()) {
      update_name(&input);
    }
  }
  for (auto& ret : *rets_to_fuse) update_name(&ret.second);
}
void RenameFunctionNodes ( const FunctionDef & first_function , protobuf :: RepeatedPtrField < NodeDef > * nodes_to_fuse , protobuf :: Map < string , string > * rets_to_fuse ) { const gtl :: FlatMap < string , string > changed_node_names = GetUniqueNames ( first_function . node_def ( ) , * nodes_to_fuse ) ; auto update_name = [ & changed_node_names ] ( string * input ) { string input_node = ParseNodeConnection ( * input ) ; auto iter = changed_node_names . find ( input_node ) ; if ( iter != changed_node_names . end ( ) ) { * input = iter -> second + ParseOutputNode ( * input ) ; } } ; for ( NodeDef & function_node : * nodes_to_fuse ) { if ( const string * new_name = gtl :: FindOrNull ( changed_node_names , function_node . name ( ) ) ) { function_node . set_name ( * new_name ) ; } for ( string & input : * function_node . mutable_input ( ) ) { update_name ( & input ) ; } } for ( auto & ret : * rets_to_fuse ) update_name ( & ret . second ) ; }
We need to rename them and the connections of the inputs that refer to them.
We need to rename them and the connections of the inputs that refer to them .