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