pub trait DimLike: Clone + Default + PartialEq + From<usize> + for<'a> TryFrom<&'a TDim, Error = TractError> + Zero + Debug + Display + Hash + Add<Self, Output = Self> + Add<usize, Output = Self> + for<'a> Add<&'a Self, Output = Self> + Sub<Self, Output = Self> + Sub<usize, Output = Self> + for<'a> Sub<&'a Self, Output = Self> + Mul<Self, Output = Self> + Mul<usize, Output = Self> + for<'a> Mul<&'a Self, Output = Self> + Div<usize, Output = Self> + Rem<usize, Output = Self> + Send + Sync + 'static + Sum + Product + ToDim {
    // Required methods
    fn maybe_div(&self, other: &Self) -> TractResult<(Self, u64)>;
    fn to_i64(&self) -> TractResult<i64>;
    fn one() -> Self;
    fn eval(&self, values: &SymbolValues) -> Self;
    fn substitute(&self, from: &Symbol, to: &Self) -> Self;

    // Provided methods
    fn divceil(&self, other: usize) -> Self { ... }
    fn to_usize(&self) -> TractResult<usize> { ... }
    fn to_isize(&self) -> TractResult<isize> { ... }
    fn to_i32(&self) -> TractResult<i32> { ... }
}
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) -> TractResult<(Self, u64)>

source

fn to_i64(&self) -> TractResult<i64>

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

source

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

Provided Methods§

source

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

Integer divise, rounding up to next integer.

source

fn to_usize(&self) -> TractResult<usize>

source

fn to_isize(&self) -> TractResult<isize>

source

fn to_i32(&self) -> TractResult<i32>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl DimLike for usize

source§

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

source§

fn to_i64(&self) -> TractResult<i64>

source§

fn one() -> usize

source§

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

source§

fn substitute(&self, _from: &Symbol, _to: &Self) -> Self

Implementors§