提交 fb6bec6a 编写于 作者: F fengjiayi

Fix a bug

上级 19dfe1f3
...@@ -222,6 +222,9 @@ class OpRegistry { ...@@ -222,6 +222,9 @@ class OpRegistry {
varmap[var.name()] = idx++; varmap[var.name()] = idx++;
} }
// ================================================ // // ================================================ //
} else {
op_info.proto_ = nullptr;
op_info.checker_ = nullptr;
} }
op_info_map().insert(std::make_pair(op_type, op_info)); op_info_map().insert(std::make_pair(op_type, op_info));
// register gradient op // register gradient op
......
...@@ -176,6 +176,9 @@ All parameter, weight, gradient are variables in Paddle. ...@@ -176,6 +176,9 @@ All parameter, weight, gradient are variables in Paddle.
std::vector<py::bytes> ret_values; std::vector<py::bytes> ret_values;
for (auto it = op_info_map.begin(); it != op_info_map.end(); ++it) { for (auto it = op_info_map.begin(); it != op_info_map.end(); ++it) {
const OpProto *proto = it->second.proto_; const OpProto *proto = it->second.proto_;
if (proto == nullptr) {
continue;
}
PADDLE_ENFORCE(proto->IsInitialized(), "OpProto must all be initialized"); PADDLE_ENFORCE(proto->IsInitialized(), "OpProto must all be initialized");
std::string str; std::string str;
PADDLE_ENFORCE(proto->SerializeToString(&str), PADDLE_ENFORCE(proto->SerializeToString(&str),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册