Skip to main content

Module dlpack

Module dlpack 

Source
Expand description

DLPack protocol for zero-copy tensor exchange.

Implements __dlpack__ and __dlpack_device__ for arrays managed by this crate. DLPack is a standard open-source ABI used by PyTorch, JAX, TensorFlow, and other frameworks to exchange tensors without copying.

Reference: https://dmlc.github.io/dlpack/latest/

Structs§

DLDataType
DLPack data-type descriptor (ABI-compatible with the DLPack spec).
DLDevice
DLPack device descriptor.
DLManagedTensor
Managed DLPack tensor with associated deleter callback.
DLPackCapsule
Python class wrapping a DLPack-compatible tensor.
DLTensor
The core DLPack tensor structure (ABI-compatible).
DLTensorInfo
Structured information extracted from a validated DLTensor.

Enums§

DLDataTypeCode
Element type codes used in DLPack DLDataType.code.
DLDeviceType
Device type codes used by DLPack.
DlpackError
Errors produced by DLPack validation and conversion utilities.

Functions§

dlpack_from_slice
Create a DLTensor that borrows data and shape slices.
dlpack_to_vec_f64
Extract a Vec<f64> from a CPU float64 DLTensor.
register_dlpack_module
Register DLPack classes into a PyO3 module.
validate_dlpack_tensor
Validate a DLTensor and extract structured metadata.