Enum tract_data::prelude::TDim
source · pub enum TDim {
Val(i64),
Sym(Symbol),
Add(Vec<TDim>),
Mul(Vec<TDim>),
MulInt(i64, Box<TDim>),
Div(Box<TDim>, u64),
}
Variants§
Implementations§
source§impl TDim
impl TDim
pub fn is_one(&self) -> bool
pub fn to_i64(&self) -> Result<i64>
pub fn as_i64(&self) -> Option<i64>
pub fn eval_to_i64(&self, values: &SymbolValues) -> Result<i64>
pub fn eval(&self, values: &SymbolValues) -> TDim
pub fn substitute(&self, from: &Symbol, to: &Self) -> Self
pub fn reduce(self) -> TDim
pub fn simplify(self) -> TDim
pub fn gcd(&self) -> u64
pub fn div_ceil(self, rhs: u64) -> TDim
pub fn slope(&self, sym: &Symbol) -> (i64, u64)
pub fn symbols(&self) -> HashSet<Symbol>
sourcepub fn compatible_with(&self, other: &TDim) -> bool
pub fn compatible_with(&self, other: &TDim) -> bool
true is both are equal of if there is one single symbol involved and there is a solution to make them equal
Trait Implementations§
source§impl<'a> AddAssign<&'a TDim> for TDim
impl<'a> AddAssign<&'a TDim> for TDim
source§fn add_assign(&mut self, rhs: &'a TDim)
fn add_assign(&mut self, rhs: &'a TDim)
Performs the
+=
operation. Read moresource§impl<I> AddAssign<I> for TDim
impl<I> AddAssign<I> for TDim
source§fn add_assign(&mut self, rhs: I)
fn add_assign(&mut self, rhs: I)
Performs the
+=
operation. Read moresource§impl DimLike for TDim
impl DimLike for TDim
fn maybe_div(&self, other: &Self) -> TractResult<(Self, u64)>
source§fn to_i64(&self) -> TractResult<i64>
fn to_i64(&self) -> TractResult<i64>
Convert to regular integer.
source§fn eval(&self, values: &SymbolValues) -> Self
fn eval(&self, values: &SymbolValues) -> Self
Substitute as many symbols as possible in the dim value.
fn substitute(&self, from: &Symbol, to: &Self) -> Self
source§fn 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 to_usize(&self) -> TractResult<usize>
fn to_isize(&self) -> TractResult<isize>
fn to_i32(&self) -> TractResult<i32>
source§impl<I: AsPrimitive<u64> + PrimInt> DivAssign<I> for TDim
impl<I: AsPrimitive<u64> + PrimInt> DivAssign<I> for TDim
source§fn div_assign(&mut self, rhs: I)
fn div_assign(&mut self, rhs: I)
Performs the
/=
operation. Read moresource§impl<'a> MulAssign<&'a TDim> for TDim
impl<'a> MulAssign<&'a TDim> for TDim
source§fn mul_assign(&mut self, rhs: &'a TDim)
fn mul_assign(&mut self, rhs: &'a TDim)
Performs the
*=
operation. Read moresource§impl<I: Into<TDim>> MulAssign<I> for TDim
impl<I: Into<TDim>> MulAssign<I> for TDim
source§fn mul_assign(&mut self, rhs: I)
fn mul_assign(&mut self, rhs: I)
Performs the
*=
operation. Read moresource§impl PartialEq for TDim
impl PartialEq for TDim
source§impl<I: AsPrimitive<u64> + PrimInt> RemAssign<I> for TDim
impl<I: AsPrimitive<u64> + PrimInt> RemAssign<I> for TDim
source§fn rem_assign(&mut self, rhs: I)
fn rem_assign(&mut self, rhs: I)
Performs the
%=
operation. Read moresource§impl<'a> SubAssign<&'a TDim> for TDim
impl<'a> SubAssign<&'a TDim> for TDim
source§fn sub_assign(&mut self, rhs: &'a TDim)
fn sub_assign(&mut self, rhs: &'a TDim)
Performs the
-=
operation. Read moresource§impl<I> SubAssign<I> for TDim
impl<I> SubAssign<I> for TDim
source§fn sub_assign(&mut self, rhs: I)
fn sub_assign(&mut self, rhs: I)
Performs the
-=
operation. Read moreimpl Eq for TDim
impl StructuralPartialEq for TDim
Auto Trait Implementations§
impl Freeze for TDim
impl RefUnwindSafe for TDim
impl Send for TDim
impl Sync for TDim
impl Unpin for TDim
impl UnwindSafe for TDim
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more