Struct 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§

Source§

impl<'tensor, C: 'tensor> ManagedTensor<'tensor, C>

Source

pub fn new( tensor: Tensor<'tensor>, manager_ctx: Option<NonNull<*mut c_void>>, ) -> Self

Contructor.

Source

pub fn set_deleter(&mut self, deleter: fn(&mut ManagedTensor<'_, C>))

Sets a deleter function pointer.

Source

pub fn into_raw(self) -> *const DLManagedTensor

Consumes the ManagedTensor and returns the raw pointer to its underlying DLManagedTensor.

Source

pub unsafe fn from_raw(ptr: *mut DLManagedTensor) -> Self

Returns a ManagedTensor instances from a raw pointer to DLManagedTensor.

Source

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>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'tensor, C> From<DLManagedTensor> for ManagedTensor<'tensor, C>

Source§

fn from(dlm: DLManagedTensor) -> Self

Converts to this type from the input type.
Source§

impl<'tensor, C> From<ManagedTensor<'tensor, C>> for DLManagedTensor

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.