Skip to content

Commit c756d17

Browse files
committed
Add DLPackTensor::version
1 parent 1fdfc3d commit c756d17

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@ impl DLPackTensor {
316316
}
317317
}
318318

319+
/// Get the ABI version of this DLPack tensor.
320+
pub fn version(&self) -> DLPackVersion {
321+
let tensor_ref = unsafe {
322+
self.raw.as_ref()
323+
};
324+
tensor_ref.version
325+
}
326+
319327
/// Get a pointer to data in this tensor. This pointer can be a device
320328
/// pointer according to [`DLPackTensor::device`].
321329
pub fn data_ptr<T>(&self) -> Result<*const T, CastError> where T: DLPackPointerCast {

0 commit comments

Comments
 (0)