tensorflow/core/framework/op_gen_lib.cc
// Initializes given ApiDef with data in OpDef.
Initializes given ApiDef with data in OpDef.
Initializes given ApiDef with data in OpDef .
void InitApiDefFromOpDef(const OpDef& op_def, ApiDef* api_def) {
  api_def->set_graph_op_name(op_def.name());
  api_def->set_visibility(ApiDef::VISIBLE);
  auto* endpoint = api_def->add_endpoint();
  endpoint->set_name(op_def.name());
  for (const auto& op_in_arg : op_def.input_arg()) {
    auto* api_in_arg = api_def->add_in_arg();
    api_in_arg->set_name(op_in_arg.name());
    api_in_arg->set_rename_to(op_in_arg.name());
    api_in_arg->set_description(op_in_arg.description());
    *api_def->add_arg_order() = op_in_arg.name();
  }
  for (const auto& op_out_arg : op_def.output_arg()) {
    auto* api_out_arg = api_def->add_out_arg();
    api_out_arg->set_name(op_out_arg.name());
    api_out_arg->set_rename_to(op_out_arg.name());
    api_out_arg->set_description(op_out_arg.description());
  }
  for (const auto& op_attr : op_def.attr()) {
    auto* api_attr = api_def->add_attr();
    api_attr->set_name(op_attr.name());
    api_attr->set_rename_to(op_attr.name());
    if (op_attr.has_default_value()) {
      *api_attr->mutable_default_value() = op_attr.default_value();
    }
    api_attr->set_description(op_attr.description());
  }
  api_def->set_summary(op_def.summary());
  api_def->set_description(op_def.description());
}
void InitApiDefFromOpDef ( const OpDef & op_def , ApiDef * api_def ) { api_def -> set_graph_op_name ( op_def . name ( ) ) ; api_def -> set_visibility ( ApiDef :: VISIBLE ) ; auto * endpoint = api_def -> add_endpoint ( ) ; endpoint -> set_name ( op_def . name ( ) ) ; for ( const auto & op_in_arg : op_def . input_arg ( ) ) { auto * api_in_arg = api_def -> add_in_arg ( ) ; api_in_arg -> set_name ( op_in_arg . name ( ) ) ; api_in_arg -> set_rename_to ( op_in_arg . name ( ) ) ; api_in_arg -> set_description ( op_in_arg . description ( ) ) ; * api_def -> add_arg_order ( ) = op_in_arg . name ( ) ; } for ( const auto & op_out_arg : op_def . output_arg ( ) ) { auto * api_out_arg = api_def -> add_out_arg ( ) ; api_out_arg -> set_name ( op_out_arg . name ( ) ) ; api_out_arg -> set_rename_to ( op_out_arg . name ( ) ) ; api_out_arg -> set_description ( op_out_arg . description ( ) ) ; } for ( const auto & op_attr : op_def . attr ( ) ) { auto * api_attr = api_def -> add_attr ( ) ; api_attr -> set_name ( op_attr . name ( ) ) ; api_attr -> set_rename_to ( op_attr . name ( ) ) ; if ( op_attr . has_default_value ( ) ) { * api_attr -> mutable_default_value ( ) = op_attr . default_value ( ) ; } api_attr -> set_description ( op_attr . description ( ) ) ; } api_def -> set_summary ( op_def . summary ( ) ) ; api_def -> set_description ( op_def . description ( ) ) ; }
Initializes given ApiDef with data in OpDef.
Initializes given ApiDef with data in OpDef .