pub enum DimExpr {
Const(usize),
Var(String),
Add(Box<DimExpr>, Box<DimExpr>),
Sub(Box<DimExpr>, Box<DimExpr>),
Mul(Box<DimExpr>, Box<DimExpr>),
Div(Box<DimExpr>, Box<DimExpr>),
Max(Box<DimExpr>, Box<DimExpr>),
Min(Box<DimExpr>, Box<DimExpr>),
CeilDiv(Box<DimExpr>, Box<DimExpr>),
}Expand description
A dimension expression that can be evaluated.
Variants§
Const(usize)
A concrete dimension value
Var(String)
A dimension variable
Add(Box<DimExpr>, Box<DimExpr>)
Addition of dimensions
Sub(Box<DimExpr>, Box<DimExpr>)
Subtraction of dimensions
Mul(Box<DimExpr>, Box<DimExpr>)
Multiplication of dimensions
Div(Box<DimExpr>, Box<DimExpr>)
Division of dimensions (integer division)
Max(Box<DimExpr>, Box<DimExpr>)
Maximum of two dimensions
Min(Box<DimExpr>, Box<DimExpr>)
Minimum of two dimensions
CeilDiv(Box<DimExpr>, Box<DimExpr>)
Ceiling division (useful for padding/strides)
Implementations§
Source§impl DimExpr
impl DimExpr
Sourcepub fn eval(&self, ctx: &DependentTypeContext) -> Option<usize>
pub fn eval(&self, ctx: &DependentTypeContext) -> Option<usize>
Evaluate the dimension expression in a context.
Sourcepub fn free_variables(&self) -> Vec<String>
pub fn free_variables(&self) -> Vec<String>
Get all free variables in this expression.
Sourcepub fn substitute(&self, var: &str, expr: &DimExpr) -> DimExpr
pub fn substitute(&self, var: &str, expr: &DimExpr) -> DimExpr
Substitute a variable with an expression.
Sourcepub fn is_equal(&self, other: &DimExpr, ctx: &DependentTypeContext) -> bool
pub fn is_equal(&self, other: &DimExpr, ctx: &DependentTypeContext) -> bool
Check if two dimension expressions are equal.
Trait Implementations§
impl StructuralPartialEq for DimExpr
Auto Trait Implementations§
impl Freeze for DimExpr
impl RefUnwindSafe for DimExpr
impl Send for DimExpr
impl Sync for DimExpr
impl Unpin for DimExpr
impl UnwindSafe for DimExpr
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