Updates api_def based on the given op.
| 39 | |
| 40 | // Updates api_def based on the given op. |
| 41 | void 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. |
| 72 | bool OpHasDocs(const OpDef& op) { |
no test coverage detected