Skip to main content

TensorLayout

Trait TensorLayout 

Source
pub unsafe trait TensorLayout {
    // Required method
    fn tensor_layout(&self) -> RawLayout;
}
Expand description

A value that a Tensor can show with no copy of the data.

A diffsol vector or dense matrix shows its storage with the lane axis last. The storage of a diffsol vector is an n × nbatch matrix with one column for each lane, which is already the shape [n, nbatch]. A dense matrix has the shape [nrows, ncols, nbatch]. A Vec<T> has the shape [len].

§Safety

TensorLayout::tensor_layout must give the layout of data that the value holds on the heap, so that the data does not move when the value moves. The data must not change while the value is borrowed (no interior mutability).

Required Methods§

Source

fn tensor_layout(&self) -> RawLayout

The layout of the data.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Scalar + FaerScalar> TensorLayout for FaerMat<T>

Source§

impl<T: Scalar + FaerScalar> TensorLayout for FaerVec<T>

Source§

impl<T: Scalar + NalgebraScalar> TensorLayout for NalgebraMat<T>

Source§

impl<T: Scalar + NalgebraScalar> TensorLayout for NalgebraVec<T>

Source§

impl<T: Scalar> TensorLayout for Vec<T>

Implementors§