[][src]Trait tension::TensorTrait

pub trait TensorTrait<T: Prm> {
    fn shape(&self) -> &[usize];
fn reshape(&self, shape: &[usize]) -> Self;
fn load(&self, dst: &mut [T]);
fn store(&mut self, src: &[T]); }

Required methods

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

Shape of the tensor - slice containing all tensor dimensions.

fn reshape(&self, shape: &[usize]) -> Self

Returns a new tensor that shares the same data but has other shape. Failed if the product of all shape dimensions is not equal to buffer size.

fn load(&self, dst: &mut [T])

Load flattened data from tensor to slice.

fn store(&mut self, src: &[T])

Store data from slice to a tensor in a flattened manner.

Loading content...

Implementors

impl<T: Prm + Interop> TensorTrait<T> for DeviceTensor<T>[src]

impl<T: Prm> TensorTrait<T> for HostTensor<T>[src]

Loading content...