tf.mixed_precision.experimental.FixedLossScale

Loss scale with a fixed value.

Inherits From: LossScale

The loss scale is not updated for the lifetime of instances of this class. A given instance of this class always returns the same number when called.

loss_scale_value A Python float. Its ideal value varies depending on models to run. Choosing a too small loss_scale might affect model quality; a too big loss_scale might cause inf or nan. There is no single right loss_scale to apply. There is no harm choosing a relatively big number as long as no nan or inf is encountered in training.

ValueError If loss_scale_value is less than 1.

Methods

from_config

View source

Creates the LossScale from its config.

get_config

View source

Returns the config of this loss scale.

update

View source

Updates the value of the loss scale.

The loss scale will be potentially updated, based on the value of grads. The tensor returned by calling this class is only updated when this function is evaluated.

In eager mode, this directly updates the loss scale, so that calling __call__ will return the newly updated loss scale. In graph mode, this returns an op that, wh