#[repr(C)]pub struct DLManagedTensor {
pub dl_tensor: DLTensor,
pub manager_ctx: *mut c_void,
pub deleter: Option<unsafe extern "C" fn(self_: *mut DLManagedTensor)>,
}Expand description
C Tensor object, manage memory of DLTensor. This data structure is intended to facilitate the borrowing of DLTensor by another framework. It is not meant to transfer the tensor. When the borrowing framework doesn’t need the tensor, it should call the deleter to notify the host that the resource is no longer needed.
\note This data structure is used as Legacy DLManagedTensor in DLPack exchange and is deprecated after DLPack v0.8 Use DLManagedTensorVersioned instead. This data structure may get renamed or deleted in future versions.
\sa DLManagedTensorVersioned
Fields§
§dl_tensor: DLTensorDLTensor which is being memory managed
manager_ctx: *mut c_voidthe context of the original host framework of DLManagedTensor in which DLManagedTensor is used in the framework. It can also be NULL.
deleter: Option<unsafe extern "C" fn(self_: *mut DLManagedTensor)>Destructor - this should be called to destruct the manager_ctx which backs the DLManagedTensor. It can be NULL if there is no way for the caller to provide a reasonable destructor. The destructor deletes the argument self as well.
Trait Implementations§
Source§impl Clone for DLManagedTensor
impl Clone for DLManagedTensor
Source§fn clone(&self) -> DLManagedTensor
fn clone(&self) -> DLManagedTensor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DLManagedTensor
Source§impl Debug for DLManagedTensor
impl Debug for DLManagedTensor
Source§impl ManagedTensorBase for DLManagedTensor
impl ManagedTensorBase for DLManagedTensor
Source§fn from_parts(
tensor: DLTensor,
manager_ctx: *mut c_void,
deleter: Option<unsafe extern "C" fn(self_: *mut Self)>,
) -> Self
fn from_parts( tensor: DLTensor, manager_ctx: *mut c_void, deleter: Option<unsafe extern "C" fn(self_: *mut Self)>, ) -> Self
Source§fn tensor_mut(&mut self) -> &mut DLTensor
fn tensor_mut(&mut self) -> &mut DLTensor
Source§fn manager_ctx(&self) -> *mut c_void
fn manager_ctx(&self) -> *mut c_void
Source§fn deleter(&self) -> Option<unsafe extern "C" fn(self_: *mut Self)>
fn deleter(&self) -> Option<unsafe extern "C" fn(self_: *mut Self)>
Source§fn flags(&self) -> DlpackFlags
fn flags(&self) -> DlpackFlags
Source§unsafe fn set_flags_unchecked(&mut self, _flags: DlpackFlags)
unsafe fn set_flags_unchecked(&mut self, _flags: DlpackFlags)
DlpackFlags::IS_COPIED. Read moreAuto Trait Implementations§
impl !Send for DLManagedTensor
impl !Sync for DLManagedTensor
impl Freeze for DLManagedTensor
impl RefUnwindSafe for DLManagedTensor
impl Unpin for DLManagedTensor
impl UnsafeUnpin for DLManagedTensor
impl UnwindSafe for DLManagedTensor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more