Struct burn_core::nn::transformer::TransformerDecoderConfig
source · pub struct TransformerDecoderConfig {
pub d_model: usize,
pub d_ff: usize,
pub n_heads: usize,
pub n_layers: usize,
pub dropout: f64,
pub norm_first: bool,
pub initializer: Initializer,
}Expand description
Configuration to create a Transformer Decoder layer.
Fields§
§d_model: usizeThe size of the model.
d_ff: usizeThe size of the position-wise feed-forward network.
n_heads: usizeThe number of attention heads.
n_layers: usizeThe number of layers.
dropout: f64The dropout rate. Default: 0.1
norm_first: boolLayer norm will be applied first instead of after the other modules.
initializer: InitializerThe type of function used to initialize neural network parameters
Implementations§
source§impl TransformerDecoderConfig
impl TransformerDecoderConfig
sourcepub fn with_dropout(self, dropout: f64) -> Self
pub fn with_dropout(self, dropout: f64) -> Self
The dropout rate. Default: 0.1
sourcepub fn with_norm_first(self, norm_first: bool) -> Self
pub fn with_norm_first(self, norm_first: bool) -> Self
Layer norm will be applied first instead of after the other modules.
sourcepub fn with_initializer(self, initializer: Initializer) -> Self
pub fn with_initializer(self, initializer: Initializer) -> Self
The type of function used to initialize neural network parameters
source§impl TransformerDecoderConfig
impl TransformerDecoderConfig
sourcepub fn init<B: Backend>(&self) -> TransformerDecoder<B>
pub fn init<B: Backend>(&self) -> TransformerDecoder<B>
Initialize a new Transformer Decoder module.
sourcepub fn init_with<B: Backend>(
&self,
record: TransformerDecoderRecord<B>
) -> TransformerDecoder<B>
pub fn init_with<B: Backend>( &self, record: TransformerDecoderRecord<B> ) -> TransformerDecoder<B>
Initialize a new Transformer Decoder module with a record.
Params
- record: the record to initialize the module with.
Trait Implementations§
source§impl Clone for TransformerDecoderConfig
impl Clone for TransformerDecoderConfig
source§impl Config for TransformerDecoderConfig
impl Config for TransformerDecoderConfig
source§fn save<P: AsRef<Path>>(&self, file: P) -> Result<()>
fn save<P: AsRef<Path>>(&self, file: P) -> Result<()>
Saves the configuration to a file. Read more
source§fn load<P: AsRef<Path>>(file: P) -> Result<Self, ConfigError>
fn load<P: AsRef<Path>>(file: P) -> Result<Self, ConfigError>
Loads the configuration from a file. Read more
source§fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
Loads the configuration from a binary buffer. Read more
source§impl<'de> Deserialize<'de> for TransformerDecoderConfig
impl<'de> Deserialize<'de> for TransformerDecoderConfig
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for TransformerDecoderConfig
impl Display for TransformerDecoderConfig
Auto Trait Implementations§
impl RefUnwindSafe for TransformerDecoderConfig
impl Send for TransformerDecoderConfig
impl Sync for TransformerDecoderConfig
impl Unpin for TransformerDecoderConfig
impl UnwindSafe for TransformerDecoderConfig
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