Description
Add support for exporting StridedMemoryView objects via the DLPack protocol.
Requested Features
Both the following protocols should be supported:
-
__dlpack__ / __dlpack_device__ - The standard Python DLPack protocol for interoperability with frameworks like NumPy, PyTorch, JAX, CuPy, etc.
-
__c_dlpack_exchange_api__ - The C-level DLPack exchange API for efficient zero-copy data sharing at the C/Cython level.
Motivation
Currently, StridedMemoryView can consume DLPack-compatible objects, but it cannot export itself as DLPack tensors. Adding export support would enable it to be seamlessly passed to any library that accepts DLPack inputs, improving interoperability across the Python data science ecosystem.
Additional Context
Description
Add support for exporting
StridedMemoryViewobjects via the DLPack protocol.Requested Features
Both the following protocols should be supported:
__dlpack__/__dlpack_device__- The standard Python DLPack protocol for interoperability with frameworks like NumPy, PyTorch, JAX, CuPy, etc.__c_dlpack_exchange_api__- The C-level DLPack exchange API for efficient zero-copy data sharing at the C/Cython level.Motivation
Currently,
StridedMemoryViewcan consume DLPack-compatible objects, but it cannot export itself as DLPack tensors. Adding export support would enable it to be seamlessly passed to any library that accepts DLPack inputs, improving interoperability across the Python data science ecosystem.Additional Context
__c_dlpack_exchange_api__: https://dmlc.github.io/dlpack/latest/c_api.html#c.DLPackExchangeAPIStridedMemoryViewdesign (RFC: RemoveStridedMemoryView(to somewhere else)? #1371)