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 : numpy.ndarray A NumPy float64 array (or any object with the buffer protocol that numpy can interpret as float64).
§Returns
PyCapsule
A capsule named "dltensor" that can be consumed by PyTorch, JAX, etc.
§Notes
The capsule owns a copy of the array data so that the Python array object
can be garbage-collected independently. The DLManagedTensor.deleter
registered in the capsule frees this copy when the consumer is done.