Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::LinearLRScheduler Class Referencefinalexport

Linear decay scheduler. More...

Inheritance diagram for Mila::Dnn::LinearLRScheduler:
Collaboration diagram for Mila::Dnn::LinearLRScheduler:

Public Member Functions

 LinearLRScheduler (double initial_lr, double final_lr, std::size_t total_steps)
double getLearningRate (std::size_t step) const override
 Get the learning rate for the provided (zero-based) step.
std::string toString () const override
 Human-readable description of the scheduler.
Public Member Functions inherited from Mila::Dnn::LearningRateScheduler
virtual ~LearningRateScheduler ()=default

Private Attributes

double final_lr_
double initial_lr_
std::size_t total_steps_

Detailed Description

Linear decay scheduler.

Linearly interpolates from initial_lr at step 0 to final_lr at total_steps. For steps >= total_steps the scheduler returns final_lr.

Preconditions:

  • total_steps > 0
  • initial_lr >= 0, final_lr >= 0

Constructor & Destructor Documentation

◆ LinearLRScheduler()

Mila::Dnn::LinearLRScheduler::LinearLRScheduler ( double initial_lr,
double final_lr,
std::size_t total_steps )
inline

Member Function Documentation

◆ getLearningRate()

double Mila::Dnn::LinearLRScheduler::getLearningRate ( std::size_t step) const
inlineoverridevirtual

Get the learning rate for the provided (zero-based) step.

Parameters
stepZero-based step index.
Returns
Scalar learning rate to use at this step.

Implements Mila::Dnn::LearningRateScheduler.

◆ toString()

std::string Mila::Dnn::LinearLRScheduler::toString ( ) const
inlineoverridevirtual

Human-readable description of the scheduler.

Implements Mila::Dnn::LearningRateScheduler.

Member Data Documentation

◆ final_lr_

double Mila::Dnn::LinearLRScheduler::final_lr_
private

◆ initial_lr_

double Mila::Dnn::LinearLRScheduler::initial_lr_
private

◆ total_steps_

std::size_t Mila::Dnn::LinearLRScheduler::total_steps_
private

The documentation for this class was generated from the following file: