mindspore.amp.LossScaler
- class mindspore.amp.LossScaler[source]
Loss scaler abstract class when using mixed precision.
Derived class needs to implement all of its methods. During training, scale and unscale is used to scale and unscale the loss value and gradients to avoid overflow, adjust is used to update the loss scale value.
Note
This is an experimental interface that is subject to change or deletion.
- abstract adjust(grads_finite)[source]
Adjust the scale_value dependent on whether grads are finite.
- Parameters
grads_finite (Tensor) – a scalar bool Tensor indicating whether the grads are finite.