pub struct EncoderConfig {
pub attention: AttentionConfig,
pub feed_forward: FeedForwardConfig,
pub layer_norm: LayerNormConfig,
pub pre_norm: bool,
}Expand description
Configuration for 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 EncoderConfig
impl EncoderConfig
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 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 EncoderConfig
impl Clone for EncoderConfig
Source§fn clone(&self) -> EncoderConfig
fn clone(&self) -> EncoderConfig
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 EncoderConfig
impl RefUnwindSafe for EncoderConfig
impl Send for EncoderConfig
impl Sync for EncoderConfig
impl Unpin for EncoderConfig
impl UnwindSafe for EncoderConfig
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