MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetGoldenApiDefs

Function GetGoldenApiDefs

tensorflow/core/api_def/api_test.cc:49–67  ·  view source on GitHub ↗

Reads golden ApiDef files and returns a map from file name to ApiDef file contents.

Source from the content-addressed store, hash-verified

47// Reads golden ApiDef files and returns a map from file name to ApiDef file
48// contents.
49void GetGoldenApiDefs(Env* env, const string& api_files_dir,
50 std::unordered_map<string, ApiDef>* name_to_api_def) {
51 std::vector<string> matching_paths;
52 TF_CHECK_OK(env->GetMatchingPaths(
53 io::JoinPath(api_files_dir, kApiDefFilePattern), &matching_paths));
54
55 for (auto& file_path : matching_paths) {
56 string file_contents;
57 TF_CHECK_OK(ReadFileToString(env, file_path, &file_contents));
58 file_contents = PBTxtFromMultiline(file_contents);
59
60 ApiDefs api_defs;
61 QCHECK(tensorflow::protobuf::TextFormat::ParseFromString(file_contents,
62 &api_defs))
63 << "Failed to load " << file_path;
64 CHECK_EQ(api_defs.op_size(), 1);
65 (*name_to_api_def)[api_defs.op(0).graph_op_name()] = api_defs.op(0);
66 }
67}
68
69void TestAllApiDefsHaveCorrespondingOp(
70 const OpList& ops, const std::unordered_map<string, ApiDef>& api_defs_map) {

Callers 2

BaseApiTestMethod · 0.85
PythonApiTestMethod · 0.85

Calls 5

ReadFileToStringFunction · 0.85
PBTxtFromMultilineFunction · 0.85
JoinPathFunction · 0.50
GetMatchingPathsMethod · 0.45
opMethod · 0.45

Tested by

no test coverage detected