pub fn to_dlpack(
_py: Python<'_>,
array: &Bound<'_, PyAny>,
) -> PyResult<Py<PyAny>>Expand description
Export a scirs2 (NumPy-compatible) array as a DLPack PyCapsule.
§Parameters
array : array-like A NumPy array (or any object with the NumPy array interface).
§Returns
PyCapsule
A capsule named "dltensor" that can be consumed by PyTorch, JAX, etc.
§Notes
The capsule wraps the array’s data pointer without copying. The array
must remain alive for the lifetime of the capsule. PyTorch’s
torch.from_dlpack(capsule) will call the registered deleter when done.