pub struct AdamPOptimizer { /* private fields */ }Expand description
AdamP optimizer with projection-based weight decay.
AdamP addresses the issue that Adam’s weight decay can slow down training on scale-invariant weights (e.g., batch normalization, layer normalization). It uses projection to apply weight decay only in the direction orthogonal to the gradient.
§Key Features
- Projection-based weight decay
- Maintains Adam’s adaptive learning rates
- Better generalization on deep networks
- Particularly effective with normalization layers
§Example
use tensorlogic_train::{AdamPOptimizer, OptimizerConfig};
let config = OptimizerConfig {
learning_rate: 0.001,
weight_decay: 0.01, // L2 regularization
..Default::default()
};
let optimizer = AdamPOptimizer::new(config);Implementations§
Source§impl AdamPOptimizer
impl AdamPOptimizer
Sourcepub fn new(config: OptimizerConfig) -> Self
pub fn new(config: OptimizerConfig) -> Self
Create a new AdamP optimizer with default parameters.
Sourcepub fn with_params(
config: OptimizerConfig,
nesterov: f64,
delta: f64,
wd_ratio: f64,
) -> Self
pub fn with_params( config: OptimizerConfig, nesterov: f64, delta: f64, wd_ratio: f64, ) -> Self
Create AdamP with custom hyperparameters.
§Arguments
config- Base optimizer configurationnesterov- Nesterov momentum coefficient (default: 0.9)delta- Projection threshold (default: 0.1)wd_ratio- Weight decay ratio (default: 1.0)
Trait Implementations§
Source§impl Clone for AdamPOptimizer
impl Clone for AdamPOptimizer
Source§fn clone(&self) -> AdamPOptimizer
fn clone(&self) -> AdamPOptimizer
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 moreSource§impl Optimizer for AdamPOptimizer
impl Optimizer for AdamPOptimizer
Auto Trait Implementations§
impl Freeze for AdamPOptimizer
impl RefUnwindSafe for AdamPOptimizer
impl Send for AdamPOptimizer
impl Sync for AdamPOptimizer
impl Unpin for AdamPOptimizer
impl UnwindSafe for AdamPOptimizer
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
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