pub enum SymDim {
Fixed(usize),
Symbolic(String),
Dynamic,
}Expand description
A dimension that can be concrete, symbolic, or fully dynamic.
This is the runtime-level counterpart to the IR’s Dim enum, but
designed for use with actual tensor operations and shape validation.
Variants§
Fixed(usize)
Known at compile time: 768, 50257, etc.
Symbolic(String)
Named symbolic dimension: “Batch”, “SeqLen”, “HiddenDim” Resolved to a concrete value at runtime via ShapeEnv.
Dynamic
Fully dynamic — matches any concrete value. Used when a dimension is truly unknown until runtime.
Implementations§
Source§impl SymDim
impl SymDim
Sourcepub fn is_symbolic(&self) -> bool
pub fn is_symbolic(&self) -> bool
Is this a symbolic (named) dimension?
Sourcepub fn is_dynamic(&self) -> bool
pub fn is_dynamic(&self) -> bool
Is this fully dynamic?
Sourcepub fn resolve(&self, env: &ShapeEnv) -> Option<usize>
pub fn resolve(&self, env: &ShapeEnv) -> Option<usize>
Try to resolve this dimension to a concrete value.
- Fixed: returns the value directly
- Symbolic: looks up the name in the environment
- Dynamic: returns None (cannot resolve without a concrete value)
Trait Implementations§
impl Eq for SymDim
impl StructuralPartialEq for SymDim
Auto Trait Implementations§
impl Freeze for SymDim
impl RefUnwindSafe for SymDim
impl Send for SymDim
impl Sync for SymDim
impl Unpin for SymDim
impl UnsafeUnpin for SymDim
impl UnwindSafe for SymDim
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