pub struct DlpackImport { /* private fields */ }Expand description
Validated owner of a DLPack producer’s managed tensor.
Implementations§
Source§impl DlpackImport
impl DlpackImport
Sourcepub unsafe fn from_raw(raw: *mut c_void) -> Result<Self, DlpackError>
pub unsafe fn from_raw(raw: *mut c_void) -> Result<Self, DlpackError>
Takes deleter ownership of a DLPack managed tensor and validates its host view.
§Safety
raw must be a live, exclusively transferred DLManagedTensorVersioned*
produced according to DLPack. The caller must not use or delete it after
this call, whether validation succeeds or fails.
Sourcepub unsafe fn from_legacy_raw(raw: *mut c_void) -> Result<Self, DlpackError>
pub unsafe fn from_legacy_raw(raw: *mut c_void) -> Result<Self, DlpackError>
Takes deleter ownership of a legacy DLPack managed tensor.
§Safety
raw must be a live, exclusively transferred legacy DLManagedTensor*.
Sourcepub const fn descriptor(&self) -> &TensorDescriptor
pub const fn descriptor(&self) -> &TensorDescriptor
Returns validated tensor metadata.
Sourcepub fn view(&self) -> Result<TensorView<'_>, DlpackError>
pub fn view(&self) -> Result<TensorView<'_>, DlpackError>
Borrows the imported host allocation without copying it.
Trait Implementations§
Source§impl Debug for DlpackImport
impl Debug for DlpackImport
Source§impl Drop for DlpackImport
impl Drop for DlpackImport
Auto Trait Implementations§
impl Freeze for DlpackImport
impl RefUnwindSafe for DlpackImport
impl !Send for DlpackImport
impl !Sync for DlpackImport
impl Unpin for DlpackImport
impl UnsafeUnpin for DlpackImport
impl UnwindSafe for DlpackImport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more