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§
- DLData
Type - DLPack data-type descriptor (ABI-compatible with the DLPack spec).
- DLDevice
- DLPack device descriptor.
- DLManaged
Tensor - Managed DLPack tensor with associated deleter callback.
- DLPack
Capsule - Python class wrapping a DLPack-compatible tensor.
- DLTensor
- The core DLPack tensor structure (ABI-compatible).
- DLTensor
Info - Structured information extracted from a validated
DLTensor.
Enums§
- DLData
Type Code - Element type codes used in DLPack
DLDataType.code. - DLDevice
Type - Device type codes used by DLPack.
- Dlpack
Error - Errors produced by DLPack validation and conversion utilities.
- JaxDevice
Type - Known device types as reported by JAX DLPack tensors.
Constants§
- DL_
DEVICE_ TYPE_ TPU - Device type constant for JAX TPU tensors.
Functions§
- array_
from_ ⚠dlpack_ f32 - Generic DLPack array construction — accepts
f32tensors from any framework. - array_
from_ ⚠dlpack_ f64 - Generic DLPack array construction — accepts
f64tensors from any framework. - check_
tensor_ contiguous - Check that a
DLTensor’s strides represent a C-order (row-major) contiguous layout. - dlarray_
from_ ⚠torch_ f32 - Convert a raw
DLTensorpointer (from a PyTorch DLPack capsule) to anndarraydynamic array view off32elements. - dlarray_
from_ ⚠torch_ f64 - Convert a raw
DLTensorpointer (from a PyTorch DLPack capsule) to anndarraydynamic array view off64elements. - dlpack_
from_ slice - Create a
DLTensorthat borrowsdataandshapeslices. - dlpack_
to_ vec_ f64 - Extract a
Vec<f64>from a CPU float64DLTensor. - jax_
device_ type - Classify the device reported by a
DLTensoras aJaxDeviceType. - register_
dlpack_ module - Register DLPack classes into a PyO3 module.
- validate_
dlpack_ tensor - Validate a
DLTensorand extract structured metadata. - validate_
jax_ dlpack_ tensor - Validate that a
DLTensoris compatible with JAX DLPack interop. - validate_
torch_ dlpack_ tensor - Validate that a
DLTensoris compatible with PyTorch DLPack interop.