Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IPU] add g_ipuplace_pytype #44648

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions paddle/fluid/pybind/place.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename PlaceType>
static inline int PlaceIndex(const PlaceType &p) { // NOLINT
Expand Down Expand Up @@ -611,7 +612,7 @@ void BindPlace(pybind11::module &m) { // NOLINT
.def("__str__", string::to_string<const platform::NPUPlace &>);

// IPUPlace
py::class_<platform::IPUPlace>(m, "IPUPlace", R"DOC(
py::class_<platform::IPUPlace> 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.

Expand All @@ -623,7 +624,9 @@ void BindPlace(pybind11::module &m) { // NOLINT

ipu_place = paddle.IPUPlace()

)DOC")
)DOC");
g_ipuplace_pytype = reinterpret_cast<PyTypeObject *>(ipuplace.ptr());
ipuplace
.def("__init__",
[](platform::IPUPlace &self) {
#ifdef PADDLE_WITH_IPU
Expand Down