mindspore.nn.LRScheduler

class mindspore.nn.LRScheduler(optimizer, last_epoch=- 1, verbose=False)[source]

Basic class of learning rate schedule.

Warning

This is an experimental lr scheduler module that is subject to change. This module must be used with optimizers in Experimental Optimizer .

Parameters
  • optimizer (mindspore.nn.optim_ex.Optimizer) – The optimizer instance.

  • last_epoch (int, optional) – The epoch/step number. Default: -1.

  • verbose (bool, optional) – Whether to print lr information. Default: False.

Raises
  • TypeError – If optimizer is not an Optimizer.

  • TypeError – If last_epoch is not greater than -1.

  • ValueError – If verbose is not bool.

Supported Platforms:

Ascend GPU CPU

get_last_lr()[source]

Return last computed learning rate by current scheduler.

step()[source]

Get the current learning rate and change the learning rate.