pub struct AttentionConfig {
pub dim: usize,
pub num_heads: usize,
pub dropout: f32,
pub scale: Option<f32>,
pub causal: bool,
}Expand description
Configuration for standard attention mechanisms.
Fields§
§dim: usizeModel dimension (d_model)
num_heads: usizeNumber of attention heads
dropout: f32Dropout probability (0.0 to 1.0)
scale: Option<f32>Scaling factor (default: 1/sqrt(d_k))
causal: boolWhether to use causal masking
Implementations§
Source§impl AttentionConfig
impl AttentionConfig
Sourcepub fn builder() -> AttentionConfigBuilder
pub fn builder() -> AttentionConfigBuilder
Creates a new builder for AttentionConfig.
Sourcepub fn validate(&self) -> AttentionResult<()>
pub fn validate(&self) -> AttentionResult<()>
Validates the configuration.
Sourcepub fn effective_scale(&self) -> f32
pub fn effective_scale(&self) -> f32
Returns the effective scale factor.
Trait Implementations§
Source§impl Clone for AttentionConfig
impl Clone for AttentionConfig
Source§fn clone(&self) -> AttentionConfig
fn clone(&self) -> AttentionConfig
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 AttentionConfig
impl Debug for AttentionConfig
Source§impl<'de> Deserialize<'de> for AttentionConfig
impl<'de> Deserialize<'de> for AttentionConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AttentionConfig
impl RefUnwindSafe for AttentionConfig
impl Send for AttentionConfig
impl Sync for AttentionConfig
impl Unpin for AttentionConfig
impl UnwindSafe for AttentionConfig
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