LRScheduler#

class braintools.optim.LRScheduler(base_lr=0.001, last_epoch=0)#

Base class for learning rate schedulers.

Can be used either standalone (passed to optimizer at initialization) or attached to an optimizer later.

apply(apply_fn)[source]#

Apply a function to modify the current learning rate.

attach_optimizer(optimizer)[source]#

Attach this scheduler to an optimizer.

get_lr()[source]#

Calculate learning rate.

load_state_dict(state_dict)[source]#

Load scheduler state from dictionary.

state_dict()[source]#

Return scheduler state as dictionary.

step(epoch=None)[source]#

Update learning rate.

step_epoch()[source]#

Step the scheduler by one epoch.