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

Function FillBaseApiDef

tensorflow/core/api_def/update_api_def.cc:41–69  ·  view source on GitHub ↗

Updates api_def based on the given op.

Source from the content-addressed store, hash-verified

39
40// Updates api_def based on the given op.
41void FillBaseApiDef(ApiDef* api_def, const OpDef& op) {
42 api_def->set_graph_op_name(op.name());
43 // Add arg docs
44 for (auto& input_arg : op.input_arg()) {
45 if (!input_arg.description().empty()) {
46 auto* api_def_in_arg = api_def->add_in_arg();
47 api_def_in_arg->set_name(input_arg.name());
48 api_def_in_arg->set_description(input_arg.description());
49 }
50 }
51 for (auto& output_arg : op.output_arg()) {
52 if (!output_arg.description().empty()) {
53 auto* api_def_out_arg = api_def->add_out_arg();
54 api_def_out_arg->set_name(output_arg.name());
55 api_def_out_arg->set_description(output_arg.description());
56 }
57 }
58 // Add attr docs
59 for (auto& attr : op.attr()) {
60 if (!attr.description().empty()) {
61 auto* api_def_attr = api_def->add_attr();
62 api_def_attr->set_name(attr.name());
63 api_def_attr->set_description(attr.description());
64 }
65 }
66 // Add docs
67 api_def->set_summary(op.summary());
68 api_def->set_description(op.description());
69}
70
71// Returns true if op has any description or summary.
72bool OpHasDocs(const OpDef& op) {

Callers 1

CreateApiDefFunction · 0.85

Calls 6

descriptionMethod · 0.80
attrMethod · 0.80
nameMethod · 0.65
emptyMethod · 0.45
set_nameMethod · 0.45
summaryMethod · 0.45

Tested by

no test coverage detected