#[repr(transparent)]pub struct ManagedTensor<'tensor, C: 'tensor> {
pub inner: ManagedTensorProxy<C>,
/* private fields */
}
Expand description
ManagedTensor type with Rust as the main owner of the underlying data.
See DLManagedTensor
Fields§
§inner: ManagedTensorProxy<C>
Implementations§
Source§impl<'tensor, C: 'tensor> ManagedTensor<'tensor, C>
impl<'tensor, C: 'tensor> ManagedTensor<'tensor, C>
Sourcepub fn new(
tensor: Tensor<'tensor>,
manager_ctx: Option<NonNull<*mut c_void>>,
) -> Self
pub fn new( tensor: Tensor<'tensor>, manager_ctx: Option<NonNull<*mut c_void>>, ) -> Self
Contructor.
Sourcepub fn set_deleter(&mut self, deleter: fn(&mut ManagedTensor<'_, C>))
pub fn set_deleter(&mut self, deleter: fn(&mut ManagedTensor<'_, C>))
Sets a deleter function pointer.
Sourcepub fn into_raw(self) -> *const DLManagedTensor
pub fn into_raw(self) -> *const DLManagedTensor
Consumes the ManagedTensor and returns the raw pointer to its underlying DLManagedTensor.
Sourcepub unsafe fn from_raw(ptr: *mut DLManagedTensor) -> Self
pub unsafe fn from_raw(ptr: *mut DLManagedTensor) -> Self
Returns a ManagedTensor instances from a raw pointer to DLManagedTensor.
Sourcepub fn into_tensor(self) -> Tensor<'tensor>
pub fn into_tensor(self) -> Tensor<'tensor>
Consumes the ManagedTensor and returns Tensor.
Trait Implementations§
Source§impl<'tensor, C: Debug + 'tensor> Debug for ManagedTensor<'tensor, C>
impl<'tensor, C: Debug + 'tensor> Debug for ManagedTensor<'tensor, C>
Source§impl<'tensor, C> From<DLManagedTensor> for ManagedTensor<'tensor, C>
impl<'tensor, C> From<DLManagedTensor> for ManagedTensor<'tensor, C>
Source§fn from(dlm: DLManagedTensor) -> Self
fn from(dlm: DLManagedTensor) -> Self
Converts to this type from the input type.
Source§impl<'tensor, C> From<ManagedTensor<'tensor, C>> for DLManagedTensor
impl<'tensor, C> From<ManagedTensor<'tensor, C>> for DLManagedTensor
Source§fn from(mt: ManagedTensor<'tensor, C>) -> Self
fn from(mt: ManagedTensor<'tensor, C>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'tensor, C> Freeze for ManagedTensor<'tensor, C>
impl<'tensor, C> RefUnwindSafe for ManagedTensor<'tensor, C>where
C: RefUnwindSafe,
impl<'tensor, C> !Send for ManagedTensor<'tensor, C>
impl<'tensor, C> !Sync for ManagedTensor<'tensor, C>
impl<'tensor, C> !Unpin for ManagedTensor<'tensor, C>
impl<'tensor, C> UnwindSafe for ManagedTensor<'tensor, C>where
C: UnwindSafe,
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