LRScheduler

class LRScheduler(optimizer: Optimizer, last_epoch: int = -1)[source]

Bases: object

Adjusts the learning rate during optimization.

Methods Summary

get_last_lr()

Return last computed learning rate by current scheduler.

get_lr()

Compute learning rate using chainable form of the scheduler.

load_state_dict(state_dict)

Load the scheduler's state.

state_dict()

Return the state of the scheduler as a dict.

step([epoch])

Perform a step.

Methods Documentation

Parameters:
get_last_lr() list[float][source]

Return last computed learning rate by current scheduler.

Return type:

list[float]

get_lr() list[float][source]

Compute learning rate using chainable form of the scheduler.

Return type:

list[float]

load_state_dict(state_dict: dict[str, Any])[source]

Load the scheduler’s state.

Args:
state_dict (dict): scheduler state. Should be an object returned

from a call to state_dict().

Parameters:

state_dict (dict[str, Any])

state_dict()[source]

Return the state of the scheduler as a dict.

It contains an entry for every variable in self.__dict__ which is not the optimizer.

step(epoch: int | None = None)[source]

Perform a step.

Parameters:

epoch (int | None)