Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | List of all members
torch.optim.lr_scheduler.LambdaLR Class Reference
Inheritance diagram for torch.optim.lr_scheduler.LambdaLR:

Public Member Functions

def __init__ (self, optimizer, lr_lambda, last_epoch=-1)
def state_dict (self)
def load_state_dict (self, state_dict)
def get_lr (self)
- Public Member Functions inherited from torch.optim.lr_scheduler._LRScheduler
def __init__ (self, optimizer, last_epoch=-1)
def state_dict (self)
def load_state_dict (self, state_dict)
def get_lr (self)
def step (self, epoch=None)

Public Attributes

- Public Attributes inherited from torch.optim.lr_scheduler._LRScheduler

Detailed Description

Sets the learning rate of each parameter group to the initial lr
times a given function. When last_epoch=-1, sets initial lr as lr.

    optimizer (Optimizer): Wrapped optimizer.
    lr_lambda (function or list): A function which computes a multiplicative
        factor given an integer parameter epoch, or a list of such
        functions, one for each group in optimizer.param_groups.
    last_epoch (int): The index of last epoch. Default: -1.

    >>> # Assuming optimizer has two groups.
    >>> lambda1 = lambda epoch: epoch // 30
    >>> lambda2 = lambda epoch: 0.95 ** epoch
    >>> scheduler = LambdaLR(optimizer, lr_lambda=[lambda1, lambda2])
    >>> for epoch in range(100):
    >>>     scheduler.step()
    >>>     train(...)
    >>>     validate(...)

Definition at line 56 of file

Member Function Documentation

def torch.optim.lr_scheduler.LambdaLR.load_state_dict (   self,
Loads the schedulers state.

    state_dict (dict): scheduler state. Should be an object returned
from a call to :meth:`state_dict`.

Definition at line 107 of file

def torch.optim.lr_scheduler.LambdaLR.state_dict (   self)
Returns the state of the scheduler as a :class:`dict`.

It contains an entry for every variable in self.__dict__ which
is not the optimizer.
The learning rate lambda functions will only be saved if they are callable objects
and not if they are functions or lambdas.

Definition at line 90 of file

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