Skip to main content

TensorMapTrait

Trait TensorMapTrait 

Source
pub trait TensorMapTrait<T>
where T: Num + Clone + Debug,
{ // Required methods fn shape(&self) -> &[usize]; fn unmap(&mut self); fn as_slice(&self) -> &[T]; fn as_mut_slice(&mut self) -> &mut [T]; // Provided methods fn len(&self) -> usize { ... } fn is_empty(&self) -> bool { ... } fn size(&self) -> usize { ... } fn view(&self) -> Result<ArrayView<'_, T, Dim<IxDynImpl>>> { ... } fn view_mut(&mut self) -> Result<ArrayViewMut<'_, T, Dim<IxDynImpl>>> { ... } }

Required Methods§

Source

fn shape(&self) -> &[usize]

Get the shape of this tensor map.

Source

fn unmap(&mut self)

Unmap the tensor from memory.

Source

fn as_slice(&self) -> &[T]

Get a slice to the data in this tensor map.

Source

fn as_mut_slice(&mut self) -> &mut [T]

Get a mutable slice to the data in this tensor map.

Provided Methods§

Source

fn len(&self) -> usize

Get the number of elements in this tensor map.

Source

fn is_empty(&self) -> bool

Check if the tensor map is empty.

Source

fn size(&self) -> usize

Get the size in bytes of this tensor map.

Source

fn view(&self) -> Result<ArrayView<'_, T, Dim<IxDynImpl>>>

Get an ndarray ArrayView of the tensor data.

Source

fn view_mut(&mut self) -> Result<ArrayViewMut<'_, T, Dim<IxDynImpl>>>

Get an ndarray ArrayViewMut of the tensor data.

Implementors§

Source§

impl<T> TensorMapTrait<T> for TensorMap<T>
where T: Num + Clone + Debug,

Source§

impl<T> TensorMapTrait<T> for DmaMap<T>
where T: Num + Clone + Debug,

Source§

impl<T> TensorMapTrait<T> for MemMap<T>
where T: Num + Clone + Debug,

Source§

impl<T> TensorMapTrait<T> for ShmMap<T>
where T: Num + Clone + Debug,