mindspore2022/docs/api/api_python/mindspore/mindspore.LossScaleManager.rst

26 lines
953 B
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.LossScaleManager
===========================
.. py:class:: mindspore.LossScaleManager
混合精度梯度放大系数loss scale管理器的抽象类。
派生类需要该类的所有方法。 `get_loss_scale` 用于获取当前的梯度放大系数。`update_loss_scale` 用于更新梯度放大系数,该方法将在训练过程中被调用。`get_update_cell` 用于获取更新梯度放大系数的 `Cell` 实例,该实例在将训练过程中被调用。下沉模式下仅 `get_update_cell` 方式生效,非下沉模式下两种更新梯度放大系数的方式均生效。
例如::class:`mindspore.FixedLossScaleManager`:class:`mindspore.DynamicLossScaleManager`
.. py:method:: get_loss_scale()
获取梯度放大系数loss scale的值。
.. py:method:: get_update_cell()
获取用于更新梯度放大系数的 :class:`mindspore.nn.Cell` 实例。
.. py:method:: update_loss_scale(overflow)
根据 `overflow` 状态更新梯度放大系数loss scale)。
**参数:**
**overflow** (bool) - 表示训练过程是否溢出。