pub struct FlashAttentionConfig {
pub block_size_m: usize,
pub block_size_n: usize,
pub causal: bool,
pub dropout: f32,
pub scale: f32,
}Expand description
Flash Attention configuration
Fields§
§block_size_m: usizeBlock size for tiling (M)
block_size_n: usizeBlock size for tiling (N)
causal: boolWhether to use causal masking
dropout: f32Dropout probability
scale: f32Scale factor (usually 1/sqrt(d_k))
Implementations§
Source§impl FlashAttentionConfig
impl FlashAttentionConfig
Sourcepub fn bidirectional(scale: f32) -> Self
pub fn bidirectional(scale: f32) -> Self
Configuration for bidirectional attention (BERT-style)
Sourcepub fn long_sequence(scale: f32) -> Self
pub fn long_sequence(scale: f32) -> Self
Configuration for long sequences
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
Auto Trait Implementations§
impl Freeze for FlashAttentionConfig
impl RefUnwindSafe for FlashAttentionConfig
impl Send for FlashAttentionConfig
impl Sync for FlashAttentionConfig
impl Unpin 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