From 859dba591baaac50656fe3e25ab5a50a17445fc5 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Thu, 21 Sep 2017 20:13:07 -0700 Subject: [PATCH] Init commit --- paddle/pybind/pybind.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/paddle/pybind/pybind.cc b/paddle/pybind/pybind.cc index c7009a604f..90b995decb 100644 --- a/paddle/pybind/pybind.cc +++ b/paddle/pybind/pybind.cc @@ -315,6 +315,23 @@ All parameter, weight, gradient are variables in Paddle. m.def("is_compile_gpu", IsCompileGPU); + py::class_(m, "ProgramDesc", "") + .def_static("instance", [] { return &GetProgramDesc(); }) + .def("append_block", [](ProgramDesc &self) { + auto desc = self.mutable_blocks()->Add(); + desc->set_idx(self.mutable_blocks()->size() - 1); + return desc; + }); + py::class_(m, "BlockDesc", "") + .def("idx", [](BlockDesc &self) { return self.idx(); }) + .def("set_parent", + [](BlockDesc &self, int32_t idx) { self.set_parent_idx(idx); }) + .def("parent", [](BlockDesc &self) { return self.parent_idx(); }); + + py::class_(m, "VarDesc", ""); + + py::class_(m, "OpDesc", ""); + return m.ptr(); } } // namespace framework -- GitLab