pub struct EncoderLayerConfig {
pub attention: AttentionConfig,
pub feed_forward: FeedForwardConfig,
pub layer_norm: LayerNormConfig,
pub pre_norm: bool,
}Expand description
Configuration for a complete transformer encoder layer
Fields§
§attention: AttentionConfigAttention configuration
feed_forward: FeedForwardConfigFeed-forward configuration
layer_norm: LayerNormConfigLayer normalization configuration
pre_norm: boolWhether to use pre-layer normalization (vs post)
Implementations§
Source§impl EncoderLayerConfig
impl EncoderLayerConfig
Sourcepub fn new(d_model: usize, n_heads: usize, d_ff: usize) -> Result<Self>
pub fn new(d_model: usize, n_heads: usize, d_ff: usize) -> Result<Self>
Create a new encoder layer configuration
Sourcepub fn with_pre_norm(self, pre_norm: bool) -> Self
pub fn with_pre_norm(self, pre_norm: bool) -> Self
Set pre-normalization vs post-normalization
Sourcepub fn with_causal(self, causal: bool) -> Self
pub fn with_causal(self, causal: bool) -> Self
Set causal masking
Sourcepub fn with_dropout(self, dropout: f64) -> Self
pub fn with_dropout(self, dropout: f64) -> Self
Set dropout
Trait Implementations§
Source§impl Clone for EncoderLayerConfig
impl Clone for EncoderLayerConfig
Source§fn clone(&self) -> EncoderLayerConfig
fn clone(&self) -> EncoderLayerConfig
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 moreAuto Trait Implementations§
impl Freeze for EncoderLayerConfig
impl RefUnwindSafe for EncoderLayerConfig
impl Send for EncoderLayerConfig
impl Sync for EncoderLayerConfig
impl Unpin for EncoderLayerConfig
impl UnwindSafe for EncoderLayerConfig
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