提交 a6b2197d 编写于 作者: Y Yu Yang

Merge branch 'feature/pybind_for_protobuf_desc' of github.com:reyoung/Paddle...

Merge branch 'feature/pybind_for_protobuf_desc' of github.com:reyoung/Paddle into feature/pybind_for_protobuf_desc
......@@ -344,8 +344,8 @@ All parameter, weight, gradient are variables in Paddle.
py::class_<BlockDesc>(m, "BlockDesc", "")
.def("id", [](BlockDesc &self) { return self.idx(); })
.def("parent", [](BlockDesc &self) { return self.parent_idx(); })
.def("append_op",
[](BlockDesc &self) { return self.mutable_ops()->Add(); });
.def("append_op", [](BlockDesc &self) { return self.add_ops(); })
.def("new_var", [](BlockDesc &self) { return self.add_vars(); });
py::class_<VarDesc>(m, "VarDesc", "")
.def(py::init<>())
......@@ -385,7 +385,7 @@ All parameter, weight, gradient are variables in Paddle.
};
auto op_desc_set_attr = [](OpDesc &desc, const std::string &name) {
auto attr = desc.mutable_attrs()->Add();
auto attr = desc.add_attrs();
attr->set_name(name);
return attr;
};
......@@ -396,7 +396,7 @@ All parameter, weight, gradient are variables in Paddle.
[op_desc_set_var](OpDesc &self,
const std::string &parameter,
const std::vector<std::string> &arguments) {
auto ipt = self.mutable_inputs()->Add();
auto ipt = self.add_inputs();
op_desc_set_var(ipt, parameter, arguments);
})
.def("input_names",
......@@ -415,7 +415,7 @@ All parameter, weight, gradient are variables in Paddle.
[op_desc_set_var](OpDesc &self,
const std::string &parameter,
const std::vector<std::string> &arguments) {
auto opt = self.mutable_outputs()->Add();
auto opt = self.add_outputs();
op_desc_set_var(opt, parameter, arguments);
})
.def("set_attr",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册