tensorflow/core/grappler/optimizers/data/fusion_utils.cc
// This function adds new nodes and changes their input to the output nodes
// of parent function.  It assumes that the name of nodes to fuse are not
// conflicting.
This function adds new nodes and changes their input to the output nodes
of parent function.  It assumes that the name of nodes to fuse are not
conflicting.
This function adds new nodes and changes their input to the output nodes of parent function . It assumes that the name of nodes to fuse are not conflicting .
void FuseFunctionNodes(const StringCollection& first_inputs,
                       const StringCollection& second_inputs,
                       const StringCollection& first_outputs,
                       const SetInputFn& set_input,
                       protobuf::RepeatedPtrField<NodeDef>* nodes_to_fuse) {
  for (NodeDef& function_node : *nodes_to_fuse) {
    for (auto& node_input : *function_node.mutable_input()) {
      auto parsed_name = ParseNodeConnection(node_input);
      auto input_it =
          std::find(second_inputs.begin(), second_inputs.end(), parsed_name);
      if (input_it == second_inputs.end()) continue;
      auto arg_num = std::distance(second_inputs.begin(), input_it);
      node_input =
          set_input(first_inputs, second_inputs, first_outputs, arg_num);
    }
  }
}
void FuseFunctionNodes ( const StringCollection & first_inputs , const StringCollection & second_inputs , const StringCollection & first_outputs , const SetInputFn & set_input , protobuf :: RepeatedPtrField < NodeDef > * nodes_to_fuse ) { for ( NodeDef & function_node : * nodes_to_fuse ) { for ( auto & node_input : * function_node . mutable_input ( ) ) { auto parsed_name = ParseNodeConnection ( node_input ) ; auto input_it = std :: find ( second_inputs . begin ( ) , second_inputs . end ( ) , parsed_name ) ; if ( input_it == second_inputs . end ( ) ) continue ; auto arg_num = std :: distance ( second_inputs . begin ( ) , input_it ) ; node_input = set_input ( first_inputs , second_inputs , first_outputs , arg_num ) ; } } }
This function adds new nodes and changes their input to the output nodes
of parent function.
This function adds new nodes and changes their input to the output nodes of parent function .