#[repr(i32)]pub enum CausalMaskKind {
kNONE = 0,
kUPPER_LEFT = 1,
kLOWER_RIGHT = 2,
}Expand description
! ! \enum CausalMaskKind ! ! \brief 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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CausalMaskKind
impl Debug for CausalMaskKind
Source§impl From<CausalMaskKind> for CausalMaskKind
impl From<CausalMaskKind> for CausalMaskKind
Source§fn from(value: CausalMaskKind) -> Self
fn from(value: CausalMaskKind) -> Self
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
Source§impl Ord for CausalMaskKind
impl Ord for CausalMaskKind
Source§fn cmp(&self, other: &CausalMaskKind) -> Ordering
fn cmp(&self, other: &CausalMaskKind) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for CausalMaskKind
impl PartialEq for CausalMaskKind
Source§fn eq(&self, other: &CausalMaskKind) -> bool
fn eq(&self, other: &CausalMaskKind) -> bool
self and other values to be equal, and is used by ==.