diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index a1e8ff6399f0812773a7bb753c90e4400b1763d9..254c4a5942db0d6b165237bda3574471a498d5e1 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -510,6 +510,11 @@ All parameter, weight, gradient are variables in Paddle. return &self.GetLocalScopes(); }, py::return_value_policy::reference) + .def("local_scopes_len", + [](ParallelExecutor &self) { return self.GetLocalScopes().size(); }) + .def("local_scope", [](ParallelExecutor &self, + size_t i) { return self.GetLocalScopes()[i]; }, + py::return_value_policy::reference) .def("run", &ParallelExecutor::Run); BindRecordIOWriter(&m);