pub struct Adam<M, E: Dtype, D: Storage<E>> {
pub cfg: AdamConfig,
/* private fields */
}
Expand description
An implementation of the Adam optimizer from Adam: A Method for Stochastic Optimization
Example Usage
let mut opt: Adam<Model, f32, Cpu> = Adam::new(&model, AdamConfig {
lr: 1e-2,
betas: [0.5, 0.25],
eps: 1e-6,
weight_decay: Some(WeightDecay::Decoupled(1e-2)),
});
See module level documentation at crate::optim for examples of how to actually use an optimizer.
Fields§
§cfg: AdamConfig
Hyperparameter configuration
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<M, E, D> RefUnwindSafe for Adam<M, E, D>where M: RefUnwindSafe, <D as Storage<E>>::Vec: RefUnwindSafe,
impl<M, E, D> !Send for Adam<M, E, D>
impl<M, E, D> !Sync for Adam<M, E, D>
impl<M, E, D> Unpin for Adam<M, E, D>
impl<M, E, D> UnwindSafe for Adam<M, E, D>where M: RefUnwindSafe, <D as Storage<E>>::Vec: RefUnwindSafe,
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