未验证 提交 a6d05771 编写于 作者: A Allen Guo 提交者: GitHub

add g_ipuplace_pytype (#44648)

上级 8bf7cd85
...@@ -200,6 +200,7 @@ PyTypeObject *g_xpuplace_pytype = nullptr; ...@@ -200,6 +200,7 @@ PyTypeObject *g_xpuplace_pytype = nullptr;
PyTypeObject *g_npuplace_pytype = nullptr; PyTypeObject *g_npuplace_pytype = nullptr;
PyTypeObject *g_cudapinnedplace_pytype = nullptr; PyTypeObject *g_cudapinnedplace_pytype = nullptr;
PyTypeObject *g_mluplace_pytype = nullptr; PyTypeObject *g_mluplace_pytype = nullptr;
PyTypeObject *g_ipuplace_pytype = nullptr;
template <typename PlaceType> template <typename PlaceType>
static inline int PlaceIndex(const PlaceType &p) { // NOLINT static inline int PlaceIndex(const PlaceType &p) { // NOLINT
...@@ -611,7 +612,7 @@ void BindPlace(pybind11::module &m) { // NOLINT ...@@ -611,7 +612,7 @@ void BindPlace(pybind11::module &m) { // NOLINT
.def("__str__", string::to_string<const platform::NPUPlace &>); .def("__str__", string::to_string<const platform::NPUPlace &>);
// IPUPlace // 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. IPUPlace is a descriptor of a device.
It represents a IPU device on which a tensor will be allocated and a model will run. 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 ...@@ -623,7 +624,9 @@ void BindPlace(pybind11::module &m) { // NOLINT
ipu_place = paddle.IPUPlace() ipu_place = paddle.IPUPlace()
)DOC") )DOC");
g_ipuplace_pytype = reinterpret_cast<PyTypeObject *>(ipuplace.ptr());
ipuplace
.def("__init__", .def("__init__",
[](platform::IPUPlace &self) { [](platform::IPUPlace &self) {
#ifdef PADDLE_WITH_IPU #ifdef PADDLE_WITH_IPU
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册