pub struct DecoderStackConfig {
pub num_layers: usize,
pub layer_config: DecoderLayerConfig,
pub position_encoding: PositionEncodingConfig,
pub final_layer_norm: bool,
}Expand description
Configuration for transformer decoder stack
Fields§
§num_layers: usizeNumber of decoder layers
layer_config: DecoderLayerConfigConfiguration for each decoder layer
position_encoding: PositionEncodingConfigPosition encoding configuration
final_layer_norm: boolWhether to apply final layer normalization
Implementations§
Source§impl DecoderStackConfig
impl DecoderStackConfig
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 decoder 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 DecoderStackConfig
impl Clone for DecoderStackConfig
Source§fn clone(&self) -> DecoderStackConfig
fn clone(&self) -> DecoderStackConfig
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 DecoderStackConfig
impl RefUnwindSafe for DecoderStackConfig
impl Send for DecoderStackConfig
impl Sync for DecoderStackConfig
impl Unpin for DecoderStackConfig
impl UnwindSafe for DecoderStackConfig
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