提交 b4d770b8 编写于 作者: L liuqi

Abort when there are no op registered.

上级 e3e82aaa
...@@ -23,7 +23,9 @@ SimpleNet::SimpleNet(const std::shared_ptr<const NetDef>& net_def, ...@@ -23,7 +23,9 @@ SimpleNet::SimpleNet(const std::shared_ptr<const NetDef>& net_def,
std::unique_ptr<OperatorBase> op{nullptr}; std::unique_ptr<OperatorBase> op{nullptr};
OperatorDef temp_def(operator_def); OperatorDef temp_def(operator_def);
op = CreateOperator(temp_def, ws, type); op = CreateOperator(temp_def, ws, type);
operators_.emplace_back(std::move(op)); if (!op) {
operators_.emplace_back(std::move(op));
}
} }
} }
bool SimpleNet::Run() { bool SimpleNet::Run() {
......
...@@ -26,8 +26,7 @@ class Registry { ...@@ -26,8 +26,7 @@ class Registry {
unique_ptr<ObjectType> Create(const SrcType& key, Args... args) { unique_ptr<ObjectType> Create(const SrcType& key, Args... args) {
if (registry_.count(key) == 0) { if (registry_.count(key) == 0) {
VLOG(2) << "Key not registered: " << key; LOG(FATAL) << "Key not registered: " << key;
return nullptr;
} }
return registry_[key](args...); return registry_[key](args...);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册