This is a minimal FFI binding to DLPack. DLPack is an open in-memory tensor structure for sharing tensors among frameworks.
Current FFI version is DLPack v1.3 (header vendored from tag v1.3, commit 84d107b). The version of this crate follows the DLPack version; this crate does not follow Rust semver, and adjustments are released as patch bumps. We do not add any safe-wrappers or abstractions on top of the FFI layer.
The binding is generated by bindgen (vendored header in header/dlpack.h, generator in scripts/bindgen.py); the only hand-written code in the crate is the test suite under tests/, which checks the ABI layout and the DLPack ownership protocol. Enumerations (DLDeviceType, DLDataTypeCode) are generated in bindgen's newtype style: a #[repr(transparent)] integer wrapper with associated constants, so that values added by future DLPack minor releases are representable without changing the API.
This crate is not an official project of the DLPack or bindgen maintainers. It serves as a minimal binding layer for users who want to build their own safe abstractions on top of the DLPack FFI.
- Header updated from DLPack v1.2 to v1.3.
- Enumerations switched to bindgen newtype style (breaking: compare against
DLDeviceType::kDL*/DLDataTypeCode::kDL*constants instead of matching enum variants, and convert to the underlying integer with.0; values from newer producers are representable rather than undefined behaviour). - ABI-layout and ownership-protocol tests added (
tests/). LICENSEfile added (Apache-2.0, as declared inCargo.toml).- Edition 2018 -> 2021; doctests disabled (
[lib] doctest = false) because generated doc comments embed C/C++ examples. - Generated with
rust-bindgen0.73.2 (was 0.72.1).