| 104 | } |
| 105 | |
| 106 | void TestAllApiDefOutputArgsAreValid( |
| 107 | const OpList& ops, const std::unordered_map<string, ApiDef>& api_defs_map) { |
| 108 | for (const auto& op : ops.op()) { |
| 109 | const auto api_def_iter = api_defs_map.find(op.name()); |
| 110 | if (api_def_iter == api_defs_map.end()) { |
| 111 | continue; |
| 112 | } |
| 113 | const auto& api_def = api_def_iter->second; |
| 114 | for (const auto& api_def_arg : api_def.out_arg()) { |
| 115 | bool found_arg = false; |
| 116 | for (const auto& op_arg : op.output_arg()) { |
| 117 | if (api_def_arg.name() == op_arg.name()) { |
| 118 | found_arg = true; |
| 119 | break; |
| 120 | } |
| 121 | } |
| 122 | ASSERT_TRUE(found_arg) |
| 123 | << "Output argument " << api_def_arg.name() |
| 124 | << " (overwritten in api_def_" << op.name() |
| 125 | << ".pbtxt) is not defined in OpDef for " << op.name(); |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | void TestAllApiDefAttributeNamesAreValid( |
| 131 | const OpList& ops, const std::unordered_map<string, ApiDef>& api_defs_map) { |