From b154c0e51ea1853ab935bf6c86966b0092babe6a Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Fri, 22 Sep 2017 10:07:17 -0700 Subject: [PATCH] Update --- paddle/pybind/pybind.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/paddle/pybind/pybind.cc b/paddle/pybind/pybind.cc index a6b583821f2..543dbb739e6 100644 --- a/paddle/pybind/pybind.cc +++ b/paddle/pybind/pybind.cc @@ -344,8 +344,12 @@ 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.add_ops(); }) - .def("new_var", [](BlockDesc &self) { return self.add_vars(); }); + .def("append_op", + [](BlockDesc &self) { return self.add_ops(); }, + py::return_value_policy::reference) + .def("new_var", + [](BlockDesc &self) { return self.add_vars(); }, + py::return_value_policy::reference); py::class_(m, "VarDesc", "") .def(py::init<>()) -- GitLab