pub struct EncoderStackConfig {
pub num_layers: usize,
pub layer_config: EncoderLayerConfig,
pub position_encoding: PositionEncodingConfig,
pub final_layer_norm: bool,
}Expand description
Configuration for transformer encoder stack
Fields§
§num_layers: usizeNumber of encoder layers
layer_config: EncoderLayerConfigConfiguration for each encoder layer
position_encoding: PositionEncodingConfigPosition encoding configuration
final_layer_norm: boolWhether to apply final layer normalization
Implementations§
Source§impl EncoderStackConfig
impl EncoderStackConfig
Sourcepub fn new(
num_layers: usize,
d_model: usize,
n_heads: usize,
d_ff: usize,
max_seq_len: usize,
) -> Result<Self>
pub fn new( num_layers: usize, d_model: usize, n_heads: usize, d_ff: usize, max_seq_len: usize, ) -> Result<Self>
Create a new encoder stack configuration
Sourcepub fn with_learned_position_encoding(self) -> Self
pub fn with_learned_position_encoding(self) -> Self
Set position encoding type to learned
Sourcepub fn with_final_layer_norm(self, final_layer_norm: bool) -> Self
pub fn with_final_layer_norm(self, final_layer_norm: bool) -> Self
Set whether to use final layer normalization
Sourcepub fn with_dropout(self, dropout: f64) -> Self
pub fn with_dropout(self, dropout: f64) -> Self
Set dropout
Trait Implementations§
Source§impl Clone for EncoderStackConfig
impl Clone for EncoderStackConfig
Source§fn clone(&self) -> EncoderStackConfig
fn clone(&self) -> EncoderStackConfig
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 EncoderStackConfig
impl RefUnwindSafe for EncoderStackConfig
impl Send for EncoderStackConfig
impl Sync for EncoderStackConfig
impl Unpin for EncoderStackConfig
impl UnwindSafe for EncoderStackConfig
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