1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Safe ownership and interoperability helpers for [DLPack].
//!
//! Producers convert into a [`Builder`], which keeps the producer alive until
//! it builds a [`ManagedBox`]. `ManagedBox` calls the DLPack deleter on drop.
//!
//! ```
//! # #[cfg(feature = "ndarray")]
//! # {
//! use dlpark::{Builder, DlpackFlags, versioned};
//! use ndarray::arr1;
//!
//! let array = Box::new(arr1(&[1_i32, 2, 3]));
//! let tensor: versioned::Dlpack = Builder::from(array)
//! .insert_flags(DlpackFlags::READ_ONLY)
//! .unwrap()
//! .try_build()
//! .unwrap();
//! assert_eq!(tensor.shape().unwrap(), &[3]);
//! # }
//! ```
//!
//! [`legacy::Dlpack`] uses `DLManagedTensor`; [`versioned::Dlpack`] uses
//! `DLManagedTensorVersioned` and exposes version and flags.
//!
//! [DLPack]: https://dmlc.github.io/dlpack/latest/
/// Raw C ABI declarations generated from the bundled DLPack headers.
/// Deferred construction of legacy and versioned managed tensors.
/// Owning managed-tensor handles and data accessors.
/// Adapters for supported Rust tensor and image libraries.
/// Python DLPack capsule, stream, and exchange API support.
/// Validation and data access methods for raw `DLTensor` values.
/// Legacy `DLManagedTensor` ownership type.
/// Shape and stride storage strategies used by [`Builder`].
/// Versioned `DLManagedTensorVersioned` ownership type.
pub use Borrowed;
pub use Builder;
pub use OpaqueContext;
pub use DlpackElement;
pub use ManagedBox;
pub use ;