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 (const: unstable) · 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 UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more