#[repr(i32)]pub enum CausalMaskKind {
kNONE = 0,
kUPPER_LEFT = 1,
kLOWER_RIGHT = 2,
}Expand description
CausalMaskKind
Enumerates the causal mask alignment orientation for the attention.
When s_q == s_kv, both kUPPER_LEFT and kLOWER_RIGHT produce identical triangular masks. When s_q != s_kv (e.g., during LLM generation where s_q=1 and s_kv grows):
- kUPPER_LEFT: Diagonal anchored at top-left corner (j <= i). Query tokens attend only to the earliest cache positions.
- kLOWER_RIGHT: Diagonal anchored at bottom-right corner (j <= i + (s_kv - s_q)). Query tokens attend to all preceding context, which is the correct behavior for autoregressive generation.
See [IAttention::setCausalKind()], IAttention::getCausalKind()
Variants§
kNONE = 0
No causal masking applied.
kUPPER_LEFT = 1
Diagonal anchored at top-left corner (legacy default when causal=true).
kLOWER_RIGHT = 2
Diagonal anchored at bottom-right corner (decode-aligned semantics).
Trait Implementations§
Source§impl Clone for CausalMaskKind
impl Clone for CausalMaskKind
Source§fn clone(&self) -> CausalMaskKind
fn clone(&self) -> CausalMaskKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Eq for CausalMaskKind
Source§impl ExternType for CausalMaskKind
impl ExternType for CausalMaskKind
Source§impl From<CausalMaskKind> for CausalMaskKind
impl From<CausalMaskKind> for CausalMaskKind
Source§fn from(value: CausalMaskKind) -> Self
fn from(value: CausalMaskKind) -> Self
Converts to this type from the input type.
Source§impl Hash for CausalMaskKind
impl Hash for CausalMaskKind
Source§impl Into<CausalMaskKind> for CausalMaskKind
impl Into<CausalMaskKind> for CausalMaskKind
Source§fn into(self) -> CausalMaskKind
fn into(self) -> CausalMaskKind
Converts this type into the (usually inferred) input type.
Source§impl PartialEq for CausalMaskKind
impl PartialEq for CausalMaskKind
Source§fn eq(&self, other: &CausalMaskKind) -> bool
fn eq(&self, other: &CausalMaskKind) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CausalMaskKind
impl UniquePtrTarget for CausalMaskKind
impl VectorElement for CausalMaskKind
impl WeakPtrTarget for CausalMaskKind
Auto Trait Implementations§
impl Freeze for CausalMaskKind
impl RefUnwindSafe for CausalMaskKind
impl Send for CausalMaskKind
impl Sync for CausalMaskKind
impl Unpin for CausalMaskKind
impl UnsafeUnpin for CausalMaskKind
impl UnwindSafe for CausalMaskKind
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