pub trait PositionalEncoding<F: Float + Debug> {
// Required methods
fn forward(&self, embeddings: &Array<F, IxDyn>) -> Result<Array<F, IxDyn>>;
fn get_encoding(&self, seq_len: usize) -> Result<Array<F, IxDyn>>;
fn update(&mut self, learning_rate: F) -> Result<()>;
// Provided methods
fn params(&self) -> Vec<Array<F, IxDyn>> ⓘ { ... }
fn set_training(&mut self, _training: bool) { ... }
fn is_training(&self) -> bool { ... }
}
Expand description
Trait for positional encoding implementations
Required Methods§
Provided Methods§
Sourcefn set_training(&mut self, _training: bool)
fn set_training(&mut self, _training: bool)
Set training mode (does nothing by default)
Sourcefn is_training(&self) -> bool
fn is_training(&self) -> bool
Get training mode (false by default)