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

Download history 1134/week @ 2025-12-06 241/week @ 2025-12-13 244/week @ 2026-01-03 234/week @ 2026-01-10 406/week @ 2026-01-17 409/week @ 2026-01-24 512/week @ 2026-01-31

1,600 downloads per month

MIT/Apache

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:

We also provide tools to convert from and to other rust types, using the TryFrom trait.

Features

  • ndarray: enable conversion from and to ndarray::Array
  • pyo3: enable passing data from and to python, following the dlpack protocol (the data is passed through a PyCapsule object).

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:

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