pub enum Dimension {
Fixed(u32),
Dynamic(Option<String>),
Symbolic(String),
}Expand description
A single tensor dimension: either a fixed size, a named symbolic parameter, or fully dynamic (unknown at compile time).
Variants§
Fixed(u32)
Fixed (static) size known at compile time.
Dynamic(Option<String>)
Dynamic (unknown) dimension with an optional name (e.g. “batch”).
Symbolic(String)
Symbolic dimension with a named constraint (e.g. “batch”, “seq_len”).
Unlike Dynamic, symbolic dimensions carry a semantic constraint:
all dimensions sharing the same symbolic name must have the same
runtime value. This enables shape validation across tensor operands.
Implementations§
Source§impl Dimension
impl Dimension
Sourcepub fn is_dynamic(&self) -> bool
pub fn is_dynamic(&self) -> bool
Returns true if this dimension is dynamic (either unnamed or named).
Sourcepub fn is_symbolic(&self) -> bool
pub fn is_symbolic(&self) -> bool
Returns true if this dimension is symbolic (named constraint).
Sourcepub fn fixed_size(&self) -> Option<u32>
pub fn fixed_size(&self) -> Option<u32>
Returns the fixed size, if known.
Sourcepub fn symbolic_name(&self) -> Option<&str>
pub fn symbolic_name(&self) -> Option<&str>
Returns the symbolic name, if any.
Trait Implementations§
impl Eq for Dimension
impl StructuralPartialEq for Dimension
Auto Trait Implementations§
impl Freeze for Dimension
impl RefUnwindSafe for Dimension
impl Send for Dimension
impl Sync for Dimension
impl Unpin for Dimension
impl UnsafeUnpin for Dimension
impl UnwindSafe for Dimension
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