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
+ One {
Show 13 methods
// Required methods
fn maybe_div(&self, other: &Self) -> TractResult<(Self, u64)>;
fn to_i64(&self) -> TractResult<i64>;
fn eval(&self, values: &SymbolValues) -> Self;
fn eval_to_i64(&self, values: &SymbolValues) -> TractResult<i64>;
fn substitute(&self, from: &Symbol, to: &Self) -> TractResult<Self>;
fn broadcast(self, other: Self) -> TractResult<Self>;
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) -> 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:
usizefor regular dimensionsTDimsupporting regular and streaming dimensions
Required Methods§
fn maybe_div(&self, other: &Self) -> TractResult<(Self, u64)>
Sourcefn to_i64(&self) -> TractResult<i64>
fn to_i64(&self) -> TractResult<i64>
Convert to regular integer.
Sourcefn eval(&self, values: &SymbolValues) -> Self
fn eval(&self, values: &SymbolValues) -> Self
Substitute as many symbols as possible in the dim value.
Sourcefn eval_to_i64(&self, values: &SymbolValues) -> TractResult<i64>
fn eval_to_i64(&self, values: &SymbolValues) -> TractResult<i64>
Full evaluation of the symbol, failing if a symbol is missing
fn substitute(&self, from: &Symbol, to: &Self) -> TractResult<Self>
fn broadcast(self, other: Self) -> TractResult<Self>
fn mini(self, other: Self) -> Self
fn maxi(self, other: Self) -> Self
fn compatible_with(&self, other: &Self) -> bool
Provided Methods§
fn to_usize(&self) -> TractResult<usize>
fn to_isize(&self) -> TractResult<isize>
fn to_i32(&self) -> TractResult<i32>
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.