Paddle conforming array_api_standards via __dlpack__ and __dlpack_device__ methods

ogq8wdun  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(39)

需求描述 Feature Description

Right now, paddle only produce and consume PyCapsules. However, dealing with raw capsules is outdated. Also, numpy doesn't supports PyCapsules. It's better if paddle tensors also support __dlpack__ and __dlpack_devce__ dunders.

替代实现 Alternatives

No response

yduiuuwa

yduiuuwa1#

Thank you for your suggestion. May I know if paddle.utils.dlpack.from_dlpack(dlpack) and paddle.utils.dlpack.from_dlpack(dlpack) can meet this requirement?

z5btuh9x

z5btuh9x2#

Hi @zhangting2020,
Thanks for your response. from_dlpack and to_dlpack are legacy functions now. All frameworks are now implementing __dlpack__ and __dlpack_device__ dunders for their Tensors. It can be seen here:
https://dmlc.github.io/dlpack/latest/python_spec.html
https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.dlpack.html

Also numpy doesn't support PyCapsules
numpy/numpy#24575

相关问题