| 80 | } |
| 81 | |
| 82 | void TestAllApiDefInputArgsAreValid( |
| 83 | const OpList& ops, const std::unordered_map<string, ApiDef>& api_defs_map) { |
| 84 | for (const auto& op : ops.op()) { |
| 85 | const auto api_def_iter = api_defs_map.find(op.name()); |
| 86 | if (api_def_iter == api_defs_map.end()) { |
| 87 | continue; |
| 88 | } |
| 89 | const auto& api_def = api_def_iter->second; |
| 90 | for (const auto& api_def_arg : api_def.in_arg()) { |
| 91 | bool found_arg = false; |
| 92 | for (const auto& op_arg : op.input_arg()) { |
| 93 | if (api_def_arg.name() == op_arg.name()) { |
| 94 | found_arg = true; |
| 95 | break; |
| 96 | } |
| 97 | } |
| 98 | ASSERT_TRUE(found_arg) |
| 99 | << "Input argument " << api_def_arg.name() |
| 100 | << " (overwritten in api_def_" << op.name() |
| 101 | << ".pbtxt) is not defined in OpDef for " << op.name(); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | void TestAllApiDefOutputArgsAreValid( |
| 107 | const OpList& ops, const std::unordered_map<string, ApiDef>& api_defs_map) { |