TensorSize

Trait TensorSize 

Source
pub trait TensorSize<const DIM: usize>: TensorDimension {
    const VALIDDIMS: bool = _;

    // Required method
    fn size(&self) -> [usize; DIM];

    // Provided methods
    fn inbounds(&self, index: [usize; DIM]) -> bool { ... }
    fn eachindex(&self) -> EachIndex<DIM> { ... }
}
Expand description

Expresses tensor-like objects with a size. Due to current compiler constraints, takes the dimension as an argument in addition to it being an associated type, to avoid internal compiler errors in use.

Provided Associated Constants§

Source

const VALIDDIMS: bool = _

If this is false, you have an invalid implementation.

Required Methods§

Source

fn size(&self) -> [usize; DIM]

Provided Methods§

Source

fn inbounds(&self, index: [usize; DIM]) -> bool

Source

fn eachindex(&self) -> EachIndex<DIM>

Returns an iterator over all valid indices.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T> TensorSize<1> for &'a [T]

Source§

fn size(&self) -> [usize; 1]

Source§

impl<'a, T> TensorSize<1> for &'a Vec<T>

Source§

fn size(&self) -> [usize; 1]

Source§

impl<'a, T> TensorSize<1> for &'a mut [T]

Source§

fn size(&self) -> [usize; 1]

Source§

impl<'a, T> TensorSize<1> for &'a mut Vec<T>

Source§

fn size(&self) -> [usize; 1]

Source§

impl<'a, T, const N: usize> TensorSize<1> for &'a [T; N]

Source§

fn size(&self) -> [usize; 1]

Source§

impl<T> TensorSize<1> for Vec<T>

Source§

fn size(&self) -> [usize; 1]

Source§

impl<T, const N: usize> TensorSize<1> for [T; N]

Source§

fn size(&self) -> [usize; 1]

Implementors§

Source§

impl<'a, R, T: Broadcastable<DIM>, F: Fn(T::Element) -> R, const DIM: usize> TensorSize<DIM> for BMap<'a, R, T, F, DIM>

Source§

impl<'a, T: Broadcastable<N>, F: Fn([usize; M], [usize; M]) -> [usize; N], const N: usize, const M: usize> TensorSize<M> for MapIndex<'a, T, F, N, M>

Source§

impl<'a, T: Broadcastable<N>, const N: usize> TensorSize<N> for BCloned<T, N>

Source§

impl<'a, T: Broadcastable<N>, const N: usize> TensorSize<N> for OffsetBroadcast<'a, T, N>

Source§

impl<'a, T: Broadcastable<OLDDIM>, const OLDDIM: usize, const DIM: usize> TensorSize<DIM> for LazyUpdim<'a, T, OLDDIM, DIM>

Source§

impl<A: Broadcastable<N>, B: Broadcastable<N>, const N: usize> TensorSize<N> for Broadcast2<A, B, N>

Source§

impl<A: Broadcastable<N>, const N: usize, const K: usize> TensorSize<N> for BroadcastK<A, N, K>

Source§

impl<T, F: Fn([usize; N]) -> T, const N: usize> TensorSize<N> for BroadcastClosure<T, F, N>

Source§

impl<T: Broadcastable<M>, const N: usize, const M: usize> TensorSize<N> for ReShaped<T, N, M>