Struct burn_core::nn::transformer::PositionWiseFeedForwardConfig
source · pub struct PositionWiseFeedForwardConfig {
pub d_model: usize,
pub d_ff: usize,
pub dropout: f64,
pub initializer: Initializer,
}Expand description
Configuration to create a position-wise feed-forward layer.
Fields§
§d_model: usizeThe size of the input and output features.
d_ff: usizeThe size of the hidden inner features.
dropout: f64The dropout rate. Default: 0.1
initializer: InitializerThe type of function used to initialize neural network parameters
Implementations§
source§impl PositionWiseFeedForwardConfig
impl PositionWiseFeedForwardConfig
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_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 PositionWiseFeedForwardConfig
impl PositionWiseFeedForwardConfig
sourcepub fn init<B: Backend>(&self) -> PositionWiseFeedForward<B>
pub fn init<B: Backend>(&self) -> PositionWiseFeedForward<B>
Initialize a new position-wise feed-forward module.
sourcepub fn init_with<B: Backend>(
&self,
record: PositionWiseFeedForwardRecord<B>
) -> PositionWiseFeedForward<B>
pub fn init_with<B: Backend>( &self, record: PositionWiseFeedForwardRecord<B> ) -> PositionWiseFeedForward<B>
Initialize a new position-wise feed-forward module with a record.
Trait Implementations§
source§impl Config for PositionWiseFeedForwardConfig
impl Config for PositionWiseFeedForwardConfig
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 PositionWiseFeedForwardConfig
impl<'de> Deserialize<'de> for PositionWiseFeedForwardConfig
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
Auto Trait Implementations§
impl RefUnwindSafe for PositionWiseFeedForwardConfig
impl Send for PositionWiseFeedForwardConfig
impl Sync for PositionWiseFeedForwardConfig
impl Unpin for PositionWiseFeedForwardConfig
impl UnwindSafe for PositionWiseFeedForwardConfig
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