NAdam optimiser — Adam with Nesterov momentum (Dozat, 2016).
Replaces the bias-corrected first-moment term with a Nesterov look-ahead that blends the current gradient and the running moment . The momentum coefficient decays each step, and its running product replaces the bias correction.
Math
where is momentum_decay. Let
and .
References
Dozat, "Incorporating Nesterov Momentum into Adam" (ICLR Workshop, 2016).
See Also
Adam, AdamW, RAdam.
Attributes
lr_float2e-3 (paper recommendation).beta1_, beta2_, eps_, weight_decay_floatAdam.momentum_decay_float4e-3.m_, v_Storage[]mu_product_double[]step_count_int64Notes
mu_product_ is a per-parameter double, not a Storage,
because it is a single scalar accumulator rather than a tensor.
Weight decay (if non-zero) is added to in the standard L2 form
— there is no published "decoupled NAdam".
Constructors
1Construct a NAdam optimiser bound to params.
Parameters
paramsvector of TensorImpl shared pointerslrfloat= None2e-3.beta1, beta2float= None0.9 / 0.999.epsfloat= None1e-8.weight_decayfloat= None0.momentum_decayfloat= None4e-3.Virtual methods
2Methods
3Allocate zero-initialised and buffers; initialise mu_product_[i] to 1.0.
Schema identifier for state_dict serialisation.
Returns
str"nadam_v1".
Compute per-step and , advance mu_product_, then apply the two-term Nesterov update.
Parameters
isize_tm_ / v_ / mu_product_.pTensorImpl shared pointergStorage