Skip to main content

cubecl_attention/components/
problem.rs

1#[derive(Clone, Debug)]
2/// Description of an attention problem to solve, regardless of actual data
3pub struct AttentionProblem {
4    /// Batch size
5    pub batch: usize,
6    /// Number of attention heads
7    pub num_heads: usize,
8
9    /// Query sequence length
10    pub seq_q: usize,
11    /// Key/Value sequence length
12    pub seq_kv: usize,
13    /// Dimension of each head (d)
14    pub head_dim: usize,
15    /// Dimension of each value vector.  
16    /// Usually equal to `head_dim`, but may differ in some variants
17    pub val_dim: usize,
18
19    /// Whether a mask is supplied (shape is always [batch, seq_q, heads, seq_kv])
20    pub masked: bool,
21    /// Whether there is a causal mask
22    pub causal: bool,
23}