Struct dlpackrs::tensor::ManagedTensor
source · [−]#[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
sourceimpl<'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
sourceimpl<'tensor, C: Debug + 'tensor> Debug for ManagedTensor<'tensor, C>
impl<'tensor, C: Debug + 'tensor> Debug for ManagedTensor<'tensor, C>
sourceimpl<'tensor, C> From<DLManagedTensor> for ManagedTensor<'tensor, C>
impl<'tensor, C> From<DLManagedTensor> for ManagedTensor<'tensor, C>
sourcefn from(dlm: DLManagedTensor) -> Self
fn from(dlm: DLManagedTensor) -> Self
Converts to this type from the input type.
sourceimpl<'tensor, C> From<ManagedTensor<'tensor, C>> for DLManagedTensor
impl<'tensor, C> From<ManagedTensor<'tensor, C>> for DLManagedTensor
sourcefn 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> 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more