Trait rai_core::Shape

source ·
pub trait Shape: Debug {
    // Required methods
    fn dims(&self) -> &[usize];
    fn ndim(&self) -> usize;

    // Provided methods
    fn size(&self) -> usize { ... }
    fn to_vec(&self) -> Vec<usize> { ... }
    fn shape_transpose(&self) -> Vec<usize> { ... }
    fn shape_at(&self, index: usize) -> usize
       where Self: Sized { ... }
    fn shape_eq(&self, rhs: &impl Shape) -> bool
       where Self: Sized { ... }
    fn shape_ndim_eq(&self, rhs: &impl Shape) -> bool
       where Self: Sized { ... }
    fn shape_size_eq(&self, rhs: &impl Shape) -> bool
       where Self: Sized { ... }
    fn shape_broadcast(&self, rhs: &impl Shape) -> Result<Vec<usize>>
       where Self: Sized { ... }
    fn shape_broadcast_matmul(&self, rhs: &impl Shape) -> Result<Vec<usize>>
       where Self: Sized { ... }
}

Required Methods§

source

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

source

fn ndim(&self) -> usize

Provided Methods§

source

fn size(&self) -> usize

source

fn to_vec(&self) -> Vec<usize>

source

fn shape_transpose(&self) -> Vec<usize>

source

fn shape_at(&self, index: usize) -> usize
where Self: Sized,

source

fn shape_eq(&self, rhs: &impl Shape) -> bool
where Self: Sized,

source

fn shape_ndim_eq(&self, rhs: &impl Shape) -> bool
where Self: Sized,

source

fn shape_size_eq(&self, rhs: &impl Shape) -> bool
where Self: Sized,

source

fn shape_broadcast(&self, rhs: &impl Shape) -> Result<Vec<usize>>
where Self: Sized,

source

fn shape_broadcast_matmul(&self, rhs: &impl Shape) -> Result<Vec<usize>>
where Self: Sized,

Implementations on Foreign Types§

source§

impl Shape for &Vec<usize>

source§

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

source§

fn ndim(&self) -> usize

source§

impl Shape for &[usize]

source§

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

source§

fn ndim(&self) -> usize

source§

impl Shape for Vec<usize>

source§

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

source§

fn ndim(&self) -> usize

source§

impl<const N: usize> Shape for &[usize; N]

source§

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

source§

fn ndim(&self) -> usize

source§

impl<const N: usize> Shape for [usize; N]

source§

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

source§

fn ndim(&self) -> usize

Implementors§