tensorflow/core/api_def/api_test.cc
// Reads golden ApiDef files and returns a map from file name to ApiDef file
// contents.
Reads golden ApiDef files and returns a map from file name to ApiDef file
contents.
Reads golden ApiDef files and returns a map from file name to ApiDef file contents .
void GetGoldenApiDefs(Env* env, const string& api_files_dir,
                      std::unordered_map<string, ApiDef>* name_to_api_def) {
  std::vector<string> matching_paths;
  TF_CHECK_OK(env->GetMatchingPaths(
      io::JoinPath(api_files_dir, kApiDefFilePattern), &matching_paths));
  for (auto& file_path : matching_paths) {
    string file_contents;
    TF_CHECK_OK(ReadFileToString(env, file_path, &file_contents));
    file_contents = PBTxtFromMultiline(file_contents);
    ApiDefs api_defs;
    QCHECK(tensorflow::protobuf::TextFormat::ParseFromString(file_contents,
                                                             &api_defs))
        << "Failed to load " << file_path;
    CHECK_EQ(api_defs.op_size(), 1);
    (*name_to_api_def)[api_defs.op(0).graph_op_name()] = api_defs.op(0);
  }
}
void GetGoldenApiDefs ( Env * env , const string & api_files_dir , std :: unordered_map < string , ApiDef > * name_to_api_def ) { std :: vector < string > matching_paths ; TF_CHECK_OK ( env -> GetMatchingPaths ( io :: JoinPath ( api_files_dir , kApiDefFilePattern ) , & matching_paths ) ) ; for ( auto & file_path : matching_paths ) { string file_contents ; TF_CHECK_OK ( ReadFileToString ( env , file_path , & file_contents ) ) ; file_contents = PBTxtFromMultiline ( file_contents ) ; ApiDefs api_defs ; QCHECK ( tensorflow :: protobuf :: TextFormat :: ParseFromString ( file_contents , & api_defs ) ) << " " << file_path ; CHECK_EQ ( api_defs . op_size ( ) , 1 ) ; ( * name_to_api_def ) [ api_defs . op ( 0 ) . graph_op_name ( ) ] = api_defs . op ( 0 ) ; } }
Reads golden ApiDef files and returns a map from file name to ApiDef file
contents.
Reads golden ApiDef files and returns a map from file name to ApiDef file contents .