check_finite_and_unscale

paddle.fluid.contrib.mixed_precision.amp_nn. check_finite_and_unscale ( x, scale, name=None, float_status=None ) [source]

Check if input X contains all finite data, if yes, scale it by input Scale.

$$Out = X / scale$$

If any tensor in X contains Inf or Nan, the Out will generate a indicator. FoundInfinite will be 1 (True), and Out will not be scaled. In this case, the data of Out should not be used, and its data may not be deterministic. Otherwise, FoundInfinite will be 0 (False).

Parameters
  • x (list|tuple) – The input tensors of check_finite_and_unscale operator.

  • scale – The scale of check_finite_and_unscale operator.

  • float_status (Tensor) – (Only used on NPU) The float status to check overflow.