pub struct Adam<B>where
B: Backend,{ /* private fields */ }Expand description
Adam optimizer (Adaptive Moment Estimation).
Standard defaults: lr=1e-3, β1=0.9, β2=0.999, ε=1e-8
Implementations§
Source§impl<B> Adam<B>where
B: Backend,
impl<B> Adam<B>where
B: Backend,
Sourcepub fn weight_decay(self, wd: f64) -> Adam<B>
pub fn weight_decay(self, wd: f64) -> Adam<B>
Set weight decay (L2 penalty).
Sourcepub fn params_mut(&mut self) -> &mut Vec<Tensor<B>>
pub fn params_mut(&mut self) -> &mut Vec<Tensor<B>>
Mutable access to current parameters (for checkpoint loading).
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Get the step count.
Trait Implementations§
Source§impl<B> Stateful for Adam<B>where
B: Backend,
impl<B> Stateful for Adam<B>where
B: Backend,
Source§fn state_dict(&self) -> OptimizerState
fn state_dict(&self) -> OptimizerState
Export the optimizer’s internal state as a serializable dictionary.
Source§fn load_state_dict(&mut self, state: &OptimizerState) -> Result<(), Error>
fn load_state_dict(&mut self, state: &OptimizerState) -> Result<(), Error>
Restore the optimizer’s internal state from a previously saved dictionary. Read more
Auto Trait Implementations§
impl<B> Freeze for Adam<B>
impl<B> RefUnwindSafe for Adam<B>
impl<B> Send for Adam<B>
impl<B> Sync for Adam<B>
impl<B> Unpin for Adam<B>
impl<B> UnwindSafe for Adam<B>
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> 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