Trait tract_pulse::internal::tract_core::ops::nn::DimLike

source ·
pub trait DimLike:
    Clone
    + Default
    + PartialEq
    + From<usize>
    + for<'a> TryFrom<&'a TDim, Error = Error>
    + Zero<Output = Self, Output = Self, Output = Self>
    + Debug
    + Display
    + Hash
    + Add
    + Add<usize>
    + for<'a> Add<&'a Self>
    + Sub<Output = Self, Output = Self, Output = Self>
    + Sub<usize>
    + for<'a> Sub<&'a Self>
    + Mul<Output = Self, Output = Self, Output = Self>
    + Mul<usize>
    + for<'a> Mul<&'a Self>
    + Div<usize, Output = Self>
    + Rem<usize, Output = Self>
    + Send
    + Sync
    + 'static
    + Sum
    + Product
    + ToDim {
Show 14 methods // Required methods fn maybe_div(&self, other: &Self) -> Result<(Self, u64), Error>; fn to_i64(&self) -> Result<i64, Error>; fn one() -> Self; fn eval(&self, values: &SymbolValues) -> Self; fn eval_to_i64(&self, values: &SymbolValues) -> Result<i64, Error>; fn substitute(&self, from: &Symbol, to: &Self) -> Result<Self, Error>; fn broadcast(self, other: Self) -> Result<Self, Error>; fn mini(self, other: Self) -> Self; fn maxi(self, other: Self) -> Self; fn compatible_with(&self, other: &Self) -> bool; // Provided methods fn divceil(&self, other: usize) -> Self { ... } fn to_usize(&self) -> Result<usize, Error> { ... } fn to_isize(&self) -> Result<isize, Error> { ... } fn to_i32(&self) -> Result<i32, Error> { ... }
}
Expand description

A super-trait for value acting as tensor dimensions in tract.

Implemented by:

  • usize for regular dimensions
  • TDim supporting regular and streaming dimensions

Required Methods§

source

fn maybe_div(&self, other: &Self) -> Result<(Self, u64), Error>

source

fn to_i64(&self) -> Result<i64, Error>

Convert to regular integer.

source

fn one() -> Self

do not use num_traits::Mul as it implies a regular Mul

source

fn eval(&self, values: &SymbolValues) -> Self

Substitute as many symbols as possible in the dim value.

source

fn eval_to_i64(&self, values: &SymbolValues) -> Result<i64, Error>

Full evaluation of the symbol, failing if a symbol is missing

source

fn substitute(&self, from: &Symbol, to: &Self) -> Result<Self, Error>

source

fn broadcast(self, other: Self) -> Result<Self, Error>

source

fn mini(self, other: Self) -> Self

source

fn maxi(self, other: Self) -> Self

source

fn compatible_with(&self, other: &Self) -> bool

Provided Methods§

source

fn divceil(&self, other: usize) -> Self

Integer divise, rounding up to next integer.

source

fn to_usize(&self) -> Result<usize, Error>

source

fn to_isize(&self) -> Result<isize, Error>

source

fn to_i32(&self) -> Result<i32, Error>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DimLike for usize

source§

fn maybe_div(&self, other: &usize) -> Result<(usize, u64), Error>

source§

fn to_i64(&self) -> Result<i64, Error>

source§

fn one() -> usize

source§

fn eval(&self, _values: &SymbolValues) -> usize

source§

fn substitute(&self, _from: &Symbol, _to: &usize) -> Result<usize, Error>

source§

fn eval_to_i64(&self, _: &SymbolValues) -> Result<i64, Error>

source§

fn broadcast(self, other: usize) -> Result<usize, Error>

source§

fn compatible_with(&self, other: &usize) -> bool

source§

fn mini(self, other: usize) -> usize

source§

fn maxi(self, other: usize) -> usize

Implementors§