pub trait Shape<const NDIM: usize> {
fn axis_len(&self, n: usize) -> usize;
fn slice(&self) -> &[usize; NDIM];
fn volume(&self) -> usize { ... }
}Expand description
Tensor shape with static dimensions but with optionally dynamic shape. To achive a static shape the trait should be const implemented.
Required Methods
Length in the nth dimension.
Example
use slas::tensor::Shape;
let s = slas::tensor::MatrixShape::<2, 3>;
assert_eq!(s.axis_len(0), 3);For a matrix the height is specified before the width. axis_len(0) is should always be the width of a tensor.