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

Function GenerateTsOpFileText

tensorflow/js/ops/ts_op_gen_test.cc:84–101  ·  view source on GitHub ↗

Generate TypeScript code

Source from the content-addressed store, hash-verified

82
83// Generate TypeScript code
84void GenerateTsOpFileText(const string& op_def_str, const string& api_def_str,
85 string* ts_file_text) {
86 Env* env = Env::Default();
87 OpList op_defs;
88 protobuf::TextFormat::ParseFromString(
89 op_def_str.empty() ? kBaseOpDef : op_def_str, &op_defs);
90 ApiDefMap api_def_map(op_defs);
91
92 if (!api_def_str.empty()) {
93 TF_ASSERT_OK(api_def_map.LoadApiDef(api_def_str));
94 }
95
96 const string& tmpdir = testing::TmpDir();
97 const auto ts_file_path = io::JoinPath(tmpdir, "test.ts");
98
99 WriteTSOps(op_defs, api_def_map, ts_file_path);
100 TF_ASSERT_OK(ReadFileToString(env, ts_file_path, ts_file_text));
101}
102
103TEST(TsOpGenTest, TestImports) {
104 string ts_file_text;

Callers 1

TESTFunction · 0.85

Calls 7

DefaultFunction · 0.85
TmpDirFunction · 0.85
WriteTSOpsFunction · 0.85
ReadFileToStringFunction · 0.85
LoadApiDefMethod · 0.80
JoinPathFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected