pub struct Adam<M> {
    pub cfg: AdamConfig,
    /* private fields */
}
Expand description

An implementation of the Adam optimizer from Adam: A Method for Stochastic Optimization

Example Usage

Constructing using default:

let mut opt: Adam<Model> = Default::default();

Changing using new

let mut opt: Adam<Model> = Adam::new(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

Constructs using hyperparameters from cfg.

Trait Implementations

Formats the value using the given formatter. Read more
Retrieves the data associated with p if there is any. This can modify self, for instance if velocities are calculated based on the associated data! Read more
Updates all of module’s parameters using gradients. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.