pub struct FlashAttentionConfig {
pub block_size: usize,
pub causal: bool,
pub softmax_eps: f64,
}Expand description
Configuration for Flash Attention computation.
Fields§
§block_size: usizeBlock size for tiled computation. Larger blocks use more memory but may be faster due to better cache utilization. Default: 64.
causal: boolWhether to use causal masking (for autoregressive models). Default: false.
softmax_eps: f64Epsilon for numerical stability in softmax. Default: 1e-6.
Implementations§
Source§impl FlashAttentionConfig
impl FlashAttentionConfig
Sourcepub fn with_block_size(block_size: usize) -> Self
pub fn with_block_size(block_size: usize) -> Self
Create a new Flash Attention config with specified block size.
Sourcepub fn with_causal(self, causal: bool) -> Self
pub fn with_causal(self, causal: bool) -> Self
Enable causal masking for autoregressive attention.
Trait Implementations§
Source§impl Clone for FlashAttentionConfig
impl Clone for FlashAttentionConfig
Source§fn clone(&self) -> FlashAttentionConfig
fn clone(&self) -> FlashAttentionConfig
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 FlashAttentionConfig
impl Debug for FlashAttentionConfig
Source§impl Default for FlashAttentionConfig
impl Default for FlashAttentionConfig
impl Copy for FlashAttentionConfig
Auto Trait Implementations§
impl Freeze for FlashAttentionConfig
impl RefUnwindSafe for FlashAttentionConfig
impl Send for FlashAttentionConfig
impl Sync for FlashAttentionConfig
impl Unpin for FlashAttentionConfig
impl UnsafeUnpin for FlashAttentionConfig
impl UnwindSafe for FlashAttentionConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more