提交 a904bdf6 编写于 作者: L Liangliang He

Fix argument checking

上级 6a4f0c12
...@@ -153,16 +153,16 @@ void WriteProtoToBinaryFile(const MessageLite& proto, const char* filename) { ...@@ -153,16 +153,16 @@ void WriteProtoToBinaryFile(const MessageLite& proto, const char* filename) {
ArgumentHelper::ArgumentHelper(const OperatorDef &def) { ArgumentHelper::ArgumentHelper(const OperatorDef &def) {
for (auto &arg : def.arg()) { for (auto &arg : def.arg()) {
if (arg_map_.count(arg.name())) { if (arg_map_.find(arg.name()) != arg_map_.end()) {
REQUIRE( REQUIRE(
arg.SerializeAsString() == arg_map_[arg.name()].SerializeAsString(), arg.SerializeAsString() == arg_map_[arg.name()].SerializeAsString(),
"Found argument of the same name ", "Found argument of the same name '",
arg.name(), arg.name(),
"but with different contents.", "' but with different contents: ",
ProtoDebugString(def)); ProtoDebugString(def));
} else {
LOG(WARNING) << "Duplicated argument name found in operator def: " LOG(WARNING) << "Duplicated argument name found in operator def: "
<< ProtoDebugString(def); << ProtoDebugString(def) << ", arg: " << ProtoDebugString(arg);
} }
arg_map_[arg.name()] = arg; arg_map_[arg.name()] = arg;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册