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

Function CreateApiDefs

tensorflow/core/api_def/update_api_def.cc:241–271  ·  view source on GitHub ↗

Creates ApiDef files for any new ops. If op_file_pattern is not empty, then also removes .Doc calls from new op registrations in these files.

Source from the content-addressed store, hash-verified

239// If op_file_pattern is not empty, then also removes .Doc calls from
240// new op registrations in these files.
241void CreateApiDefs(const OpList& ops, const string& api_def_dir,
242 const string& op_file_pattern) {
243 auto* excluded_ops = GetExcludedOps();
244 std::vector<const OpDef*> new_ops_with_docs;
245
246 for (const auto& op : ops.op()) {
247 if (excluded_ops->find(op.name()) != excluded_ops->end()) {
248 continue;
249 }
250 // Form the expected ApiDef path.
251 string file_path =
252 io::JoinPath(tensorflow::string(api_def_dir), kApiDefFileFormat);
253 file_path = strings::Printf(file_path.c_str(), op.name().c_str());
254
255 // Create ApiDef if it doesn't exist.
256 if (!Env::Default()->FileExists(file_path).ok()) {
257 std::cout << "Creating ApiDef file " << file_path << std::endl;
258 const auto& api_def_text = CreateApiDef(op);
259 TF_CHECK_OK(WriteStringToFile(Env::Default(), file_path, api_def_text));
260
261 if (OpHasDocs(op)) {
262 new_ops_with_docs.push_back(&op);
263 }
264 }
265 }
266 if (!op_file_pattern.empty()) {
267 std::vector<string> op_files;
268 TF_CHECK_OK(Env::Default()->GetMatchingPaths(op_file_pattern, &op_files));
269 RemoveDocs(new_ops_with_docs, op_files);
270 }
271}
272} // namespace tensorflow

Callers 1

mainFunction · 0.85

Calls 15

PrintfFunction · 0.85
DefaultFunction · 0.85
CreateApiDefFunction · 0.85
WriteStringToFileFunction · 0.85
OpHasDocsFunction · 0.85
RemoveDocsFunction · 0.85
c_strMethod · 0.80
nameMethod · 0.65
JoinPathFunction · 0.50
opMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected