pub struct Adam<M, E: Dtype, D: DeviceStorage> {
pub cfg: AdamConfig<E>,
/* 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<E>
Hyperparameter configuration
Implementations§
source§impl<M, E: Dtype, D: DeviceStorage> Adam<M, E, D>
impl<M, E: Dtype, D: DeviceStorage> Adam<M, E, D>
sourcepub fn new(_model: &M, cfg: AdamConfig<E>) -> Self
pub fn new(_model: &M, cfg: AdamConfig<E>) -> Self
Constructs using hyperparameters from cfg
.