Returns true if descriptions and summaries in op match a given single doc-string.
| 123 | // Returns true if descriptions and summaries in op match a |
| 124 | // given single doc-string. |
| 125 | bool ValidateOpDocs(const OpDef& op, const string& doc) { |
| 126 | OpDefBuilder b(op.name()); |
| 127 | // We don't really care about type we use for arguments and |
| 128 | // attributes. We just want to make sure attribute and argument names |
| 129 | // are added so that descriptions can be assigned to them when parsing |
| 130 | // documentation. |
| 131 | for (const auto& arg : op.input_arg()) { |
| 132 | b.Input(arg.name() + ":string"); |
| 133 | } |
| 134 | for (const auto& arg : op.output_arg()) { |
| 135 | b.Output(arg.name() + ":string"); |
| 136 | } |
| 137 | for (const auto& attr : op.attr()) { |
| 138 | b.Attr(attr.name() + ":string"); |
| 139 | } |
| 140 | b.Doc(doc); |
| 141 | OpRegistrationData op_reg_data; |
| 142 | TF_CHECK_OK(b.Finalize(&op_reg_data)); |
| 143 | return CheckDocsMatch(op, op_reg_data.op_def); |
| 144 | } |
| 145 | } // namespace |
| 146 | |
| 147 | string RemoveDoc(const OpDef& op, const string& file_contents, |