Expand description
This module provides conversions between Arc<Mutex<Array<T, D>>> and
Arc<RwLock<Array<T, D>>> to DLPackTensor, allowing you to share data
between Rust and DLPack while ensuring that the data is not modified by Rust
while it’s used by DLPack and reciprocally. The locks will be held until the
DLPackTensor is dropped, ensuring safe access to the data.
The following conversions to DLPack types are supported:
Arc<Mutex<Array<T, D>>> -> DLPackTensorReadOnly<Arc<RwLock<Array<T, D>>>> -> DLPackTensor, creating a read-only DLPack tensor and locking theRwLockfor reading.ReadWrite<Arc<RwLock<Array<T, D>>>> -> DLPackTensor, creating a read-write DLPack tensor and locking theRwLockfor writing.