Trait VirtualTensorOperations

Source
pub trait VirtualTensorOperations<E: Numeric> {
    // Provided methods
    fn read(&self, _index: u32) -> Line<E> { ... }
    fn write(&self, _index: u32, _value: Line<E>) { ... }
    fn shape(&self, _axis: u32) -> u32 { ... }
    fn stride(&self, _axis: u32) -> u32 { ... }
    fn rank(&self) -> u32 { ... }
}
Expand description

Trait to be implemented by a type that can become a virtual tensor.

The expand trait also need to be implemented for the type’s expand type.

§Warning

This trait is kind of unsafe, VirtualTensorOperations::write doesn’t follow the mutability rules, but it won’t lead to any undefined behavior.

Provided Methods§

Source

fn read(&self, _index: u32) -> Line<E>

Read the tensor at the given index.

Source

fn write(&self, _index: u32, _value: Line<E>)

Write the tensor at the given index.

Source

fn shape(&self, _axis: u32) -> u32

Get the shape of the tensor at the given axis.

Source

fn stride(&self, _axis: u32) -> u32

Get the stride of the tensor at the given axis.

Source

fn rank(&self) -> u32

Get the rank of the tensor.

Implementations on Foreign Types§

Source§

impl<E: Numeric> VirtualTensorOperations<E> for Tensor<Line<E>>

Source§

impl<E: Numeric> VirtualTensorOperations<E> for TensorMap<E>

Implementors§