4 releases
| new 0.1.3 | Feb 12, 2026 |
|---|---|
| 0.1.2 | Feb 2, 2026 |
| 0.1.1 | Jan 26, 2026 |
| 0.1.0 | Dec 1, 2025 |
#318 in Machine learning
1,600 downloads per month
100KB
1.5K
SLoC
DLPack integration for Rust.
This crate provides wrappers around the DLPack C API, allowing to exchange tensors with other libraries that support DLPack, such as PyTorch, TensorFlow, MXNet, CuPy, JAX, etc.
The C API is available in the sys module, and the following higher-level
wrappers are provided:
DLPackTensor: an owned DLPack tensorDLPackTensorRef: a borrowed DLPack tensor (immutable)DLPackTensorRefMut: a borrowed DLPack tensor (mutable)
We also provide tools to convert from and to other rust types, using the
TryFrom trait.
Features
dlpk: DLPack integration for Rust
This crate contains a direct translation of the C header for DLPack, which is intended to be used inside Rust projects that want to offer a C API.
We also provide some tools to convert to and from other types, through the following cargo features:
ndarrayto convert from and tondarray::Arraypyo3to convert from and to Python data, following the python specification for dlpack
License
This crate is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
Dependencies
~0–1.2MB
~23K SLoC