Struct dlpackrs::tensor::ManagedTensor
source · [−]#[repr(transparent)]pub struct ManagedTensor<'tensor, 'ctx: 'tensor> {
pub inner: ManagedTensorProxy<'ctx>,
/* private fields */
}
Expand description
ManagedTensor type with Rust as the main owner of the underlying data.
See DLManagedTensor
Fields
inner: ManagedTensorProxy<'ctx>
Implementations
sourceimpl<'tensor, 'ctx> ManagedTensor<'tensor, 'ctx>
impl<'tensor, 'ctx> ManagedTensor<'tensor, 'ctx>
pub fn new(tensor: Tensor<'tensor>, manager_ctx: *mut c_void) -> Self
sourcepub fn set_deleter(
&mut self,
deleter: unsafe extern "C" fn(_: *mut DLManagedTensor)
)
pub fn set_deleter(
&mut self,
deleter: unsafe extern "C" fn(_: *mut DLManagedTensor)
)
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
Auto Trait Implementations
impl<'tensor, 'ctx> RefUnwindSafe for ManagedTensor<'tensor, 'ctx>
impl<'tensor, 'ctx> !Send for ManagedTensor<'tensor, 'ctx>
impl<'tensor, 'ctx> !Sync for ManagedTensor<'tensor, 'ctx>
impl<'tensor, 'ctx> Unpin for ManagedTensor<'tensor, 'ctx>
impl<'tensor, 'ctx> UnwindSafe for ManagedTensor<'tensor, 'ctx>
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