Adamax optimiser — Adam variant using the infinity norm.
Replaces Adam's second-moment estimate with an exponentially decayed running maximum, giving a bounded effective step size that is well-behaved when occasional gradient components are very large.
Math
The second-moment recursion is the limit of an Adam-style EMA as , hence "max".
References
Kingma & Ba, "Adam: A Method for Stochastic Optimization", §7.1 "Adamax" (ICLR 2015).
See Also
Adagrad, Adadelta, RMSprop
Parameters
paramsvector of TensorImpllrfloat, default 2e-3beta1float, default 0.9beta2float, default 0.999epsfloat, default 1e-8weight_ decayfloat, default 0.0Attributes
m_vector of Storageu_vector of StorageNotes
Unlike Adam there is no bias correction on — the running max is naturally bounded, so dividing it by would over-amplify the very first updates.
Constructors
1Construct the optimiser and resize per-slot state vectors.
Parameters
paramsvector of TensorImpllrfloat, default 2e-3beta1float, default 0.9beta2float, default 0.999epsfloat, default 1e-8weight_ decayfloat, default 0.0Static methods
1check_hyperparams
void check_hyperparams(double lr, double beta1, double beta2, double eps, double weight_decay)Check Adamax's hyper-parameters — the reference framework's constructor checks, run by the constructor and set_hyperparams.
Raises
InvalidArgumentlr, eps or weight_decay is negative or NaN, or a beta lies outside [0, 1).Virtual methods
2Methods
5Allocate the per-slot state buffers for parameter i.
Parameters
iintNotes
Both m_[i] (first moment) and u_[i] (infinity norm) are
zero-initialised.
set_hyperparams
void set_hyperparams(double lr, double beta1, double beta2, double eps, double weight_decay)Replace the hyper-parameters between steps; nothing is applied when check_hyperparams rejects them.
Return the versioned state-dict identifier.
Returns
str"adamax_v1" — used by serialisation to validate state-dict layout.
Apply one Adamax update to parameter i.
Parameters
iintgStoragep on this step.Notes
Advances via the EMA, refreshes the envelope , then applies the bias-corrected step in one fused pass.