tensorflow/tools/graph_transforms/backports.cc
// Switch any ConcatV2 nodes to the v1 version, swapping the input order.
Switch any ConcatV2 nodes to the v1 version, swapping the input order.
Switch any ConcatV2 nodes to the v1 version swapping the input order .
Status BackportConcatV2Transform(const GraphDef& input_graph_def,
                                 const TransformFuncContext& context,
                                 GraphDef* output_graph_def) {
  TF_RETURN_IF_ERROR(ReplaceMatchingOpTypes(
      input_graph_def, {"ConcatV2"},
      [](const NodeMatch& match, const std::set<string>& input_nodes,
         const std::set<string>& output_nodes,
         std::vector<NodeDef>* new_nodes) {
        const NodeDef& concat_v2_node = match.node;
        NodeDef concat_node = concat_v2_node;
        concat_node.set_op("Concat");
        concat_node.mutable_input()->Clear();
        const string& dim_input =
            concat_v2_node.input(concat_v2_node.input_size() - 1);
        concat_node.add_input(dim_input);
        for (int i = 0; i < (concat_v2_node.input_size() - 1); ++i) {
          concat_node.add_input(concat_v2_node.input(i));
        }
        concat_node.mutable_attr()->erase("Tidx");
        new_nodes->push_back(concat_node);
        return Status::OK();
      },
      {true}, output_graph_def));
  return Status::OK();
}
Status BackportConcatV2Transform ( const GraphDef & input_graph_def , const TransformFuncContext & context , GraphDef * output_graph_def ) { TF_RETURN_IF_ERROR ( ReplaceMatchingOpTypes ( input_graph_def , { " " } , [ ] ( const NodeMatch & match , const std :: set < string > & input_nodes , const std :: set < string > & output_nodes , std :: vector < NodeDef > * new_nodes ) { const NodeDef & concat_v2_node = match . node ; NodeDef concat_node = concat_v2_node ; concat_node . set_op ( " " ) ; concat_node . mutable_input ( ) -> Clear ( ) ; const string & dim_input = concat_v2_node . input ( concat_v2_node . input_size ( ) - 1 ) ; concat_node . add_input ( dim_input ) ; for ( int i = 0 ; i < ( concat_v2_node . input_size ( ) - 1 ) ; ++ i ) { concat_node . add_input ( concat_v2_node . input ( i ) ) ; } concat_node . mutable_attr ( ) -> erase ( " " ) ; new_nodes -> push_back ( concat_node ) ; return Status :: OK ( ) ; } , { true } , output_graph_def ) ) ; return Status :: OK ( ) ; }
Switch any ConcatV2 nodes to the v1 version, swapping the input order.
Switch any ConcatV2 nodes to the v1 version swapping the input order .
// The last input is inserted at the head of the inputs, because Concat // expects the dimension as the first input (not the last as in // ConcatV2). // Tidx attribute must be deleted because it's not used in Concat.