pub struct FlashConfig {
pub block_size_q: usize,
pub block_size_kv: usize,
pub causal: bool,
pub dropout_p: f32,
}Expand description
Configuration for FlashAttention tiled computation.
Fields§
§block_size_q: usizeBlock size along the query dimension (Br).
block_size_kv: usizeBlock size along the key/value dimension (Bc).
causal: boolWhether to apply causal masking (upper-triangular mask).
dropout_p: f32Dropout probability (0.0 = no dropout). Applied conceptually but not stochastically in this CPU implementation.
Implementations§
Source§impl FlashConfig
impl FlashConfig
Sourcepub fn new(block_size_q: usize, block_size_kv: usize) -> AttentionResult<Self>
pub fn new(block_size_q: usize, block_size_kv: usize) -> AttentionResult<Self>
Creates a config with custom block sizes.
Sourcepub fn with_causal(self) -> Self
pub fn with_causal(self) -> Self
Returns a causal variant of this config.
Sourcepub fn with_dropout(self, p: f32) -> AttentionResult<Self>
pub fn with_dropout(self, p: f32) -> AttentionResult<Self>
Sets the dropout probability.
Trait Implementations§
Source§impl Clone for FlashConfig
impl Clone for FlashConfig
Source§fn clone(&self) -> FlashConfig
fn clone(&self) -> FlashConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FlashConfig
impl Debug for FlashConfig
Auto Trait Implementations§
impl Freeze for FlashConfig
impl RefUnwindSafe for FlashConfig
impl Send for FlashConfig
impl Sync for FlashConfig
impl Unpin for FlashConfig
impl UnsafeUnpin for FlashConfig
impl UnwindSafe for FlashConfig
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