Skip to content
class

StepLR

extendsLRScheduler
StepLR

Step decay — multiply lr by γ\gamma every step_size epochs.

Math

ηt=η0⋅γ⌊t/s⌋ \eta_t = \eta_0 \cdot \gamma^{\lfloor t / s \rfloor}

where ss is step_size and η0\eta_0 is base_lr_.

References

Classical staircase schedule used since AlexNet (Krizhevsky 2012).

Attributes

step_size_int
Period in epochs between successive decays.
gamma_float
Multiplicative decay factor.

Constructors

1
ctor

StepLR

void StepLR(Optimizer & opt, int step_size, double gamma)

Build a step-decay schedule.

Parameters

Target optimiser.
step_sizeint
Period in epochs.
gammafloat, default 0.1
Multiplicative decay factor.

Methods

1
fnconst

compute_lr_at

→float
double compute_lr_at(int epoch)

Evaluate the step-decay formula at epoch.

Parameters

epochint
Current epoch.

Returns

float

base_lr_ * gamma_ ** (epoch / step_size_).