From a904bdf6fd0990719c5c8afcbf26390f1503f680 Mon Sep 17 00:00:00 2001 From: Liangliang He Date: Wed, 6 Sep 2017 10:22:16 +0800 Subject: [PATCH] Fix argument checking --- mace/core/proto_utils.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mace/core/proto_utils.cc b/mace/core/proto_utils.cc index db9af80a..0332424c 100644 --- a/mace/core/proto_utils.cc +++ b/mace/core/proto_utils.cc @@ -153,16 +153,16 @@ void WriteProtoToBinaryFile(const MessageLite& proto, const char* filename) { ArgumentHelper::ArgumentHelper(const OperatorDef &def) { for (auto &arg : def.arg()) { - if (arg_map_.count(arg.name())) { + if (arg_map_.find(arg.name()) != arg_map_.end()) { REQUIRE( arg.SerializeAsString() == arg_map_[arg.name()].SerializeAsString(), - "Found argument of the same name ", + "Found argument of the same name '", arg.name(), - "but with different contents.", + "' but with different contents: ", ProtoDebugString(def)); - } else { + LOG(WARNING) << "Duplicated argument name found in operator def: " - << ProtoDebugString(def); + << ProtoDebugString(def) << ", arg: " << ProtoDebugString(arg); } arg_map_[arg.name()] = arg; -- GitLab