diff --git a/paddle/pybind/pybind.cc b/paddle/pybind/pybind.cc index cae36713509b32627e4eecf9a6153d19a2f2b9b5..a6b583821f261a9848153e7ba99295ec2dce106e 100644 --- a/paddle/pybind/pybind.cc +++ b/paddle/pybind/pybind.cc @@ -344,8 +344,8 @@ All parameter, weight, gradient are variables in Paddle. py::class_(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_(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 ¶meter, const std::vector &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 ¶meter, const std::vector &arguments) { - auto opt = self.mutable_outputs()->Add(); + auto opt = self.add_outputs(); op_desc_set_var(opt, parameter, arguments); }) .def("set_attr",