diff --git a/paddle/pybind/pybind.cc b/paddle/pybind/pybind.cc index c7009a604f60cda11434ad33b6c7d7caee1befdd..90b995decb9a6b5b684efc44abe8fc280ed73adc 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