From a6d05771c29de11e4e3165c57d1cad4738cb494a Mon Sep 17 00:00:00 2001 From: Allen Guo Date: Wed, 27 Jul 2022 16:46:08 +0800 Subject: [PATCH] add g_ipuplace_pytype (#44648) --- paddle/fluid/pybind/place.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/pybind/place.cc b/paddle/fluid/pybind/place.cc index 217edf96f1..63d98c3474 100644 --- a/paddle/fluid/pybind/place.cc +++ b/paddle/fluid/pybind/place.cc @@ -200,6 +200,7 @@ PyTypeObject *g_xpuplace_pytype = nullptr; PyTypeObject *g_npuplace_pytype = nullptr; PyTypeObject *g_cudapinnedplace_pytype = nullptr; PyTypeObject *g_mluplace_pytype = nullptr; +PyTypeObject *g_ipuplace_pytype = nullptr; template static inline int PlaceIndex(const PlaceType &p) { // NOLINT @@ -611,7 +612,7 @@ void BindPlace(pybind11::module &m) { // NOLINT .def("__str__", string::to_string); // IPUPlace - py::class_(m, "IPUPlace", R"DOC( + py::class_ ipuplace(m, "IPUPlace", R"DOC( IPUPlace is a descriptor of a device. It represents a IPU device on which a tensor will be allocated and a model will run. @@ -623,7 +624,9 @@ void BindPlace(pybind11::module &m) { // NOLINT ipu_place = paddle.IPUPlace() - )DOC") + )DOC"); + g_ipuplace_pytype = reinterpret_cast(ipuplace.ptr()); + ipuplace .def("__init__", [](platform::IPUPlace &self) { #ifdef PADDLE_WITH_IPU -- GitLab