mindspore.amp.LossScaleManager

class mindspore.amp.LossScaleManager[source]

Loss scale (Magnification factor of gradients when mix precision is used) manager abstract class when using mixed precision.

Derived class needs to implement all of its methods. get_loss_scale is used to get current loss scale value. update_loss_scale is used to update loss scale value, update_loss_scale will be called during the training. get_update_cell is used to get the instance of mindspore.nn.Cell that is used to update the loss scale, the instance will be called during the training. Currently, the get_update_cell is mostly used.

For example, mindspore.amp.FixedLossScaleManager and mindspore.amp.DynamicLossScaleManager.

get_loss_scale()[source]

Get the value of loss scale, which is the amplification factor of the gradients.

get_update_cell()[source]

Get the instance of mindspore.nn.Cell that is used to update the loss scale.

update_loss_scale(overflow)[source]

Update the loss scale value according to the status of overflow.

Parameters

overflow (bool) – Whether the overflow occurs during the training.