Skip to content
class

LambdaLR

extendsLRScheduler
LambdaLR

User-defined schedule driven by a callable.

Math

ηt=η0⋅lr_lambda(t) \eta_t = \eta_0 \cdot \texttt{lr\_lambda}(t)

Parameters

Target optimiser.
lr_lambdacallable[int -> float]
Function returning the multiplicative factor for a given epoch.

Attributes

lr_lambda_``std::function<double(std::int64_t)>``
Stored callable.

Notes

Useful for warm-up + decay composites that are not worth giving a dedicated subclass.

Constructors

1
ctor

LambdaLR

void LambdaLR(Optimizer & opt, int lr_lambda)

Build a callable-driven schedule.

Parameters

Target optimiser.
lr_lambdacallable[int -> float]
Returns the multiplicative factor on base_lr_ for a given epoch.

Methods

1
fnconst

compute_lr_at

→float
double compute_lr_at(int epoch)

Evaluate base_lr_ * lr_lambda_(epoch).

Parameters

epochint
Current epoch.

Returns

float

Scheduled learning rate.