mindspore.amp.all_finite

mindspore.amp.all_finite(inputs, status=None)[source]

Returns a scalar Tensor indicating whether the inputs are finite.

Note

This is an experimental interface that is subject to change or deletion.

The interface must be used in whole network training scenario to detect whether grads are finite, and the results may be different on different device targets.

Parameters
  • inputs (Union(tuple(Tensor), list(Tensor))) – a iterable Tensor.

  • status (Tensor) – the status Tensor for overflow detection, only required on Ascend. Default: None.

Returns

Tensor, a scalar Tensor and the dtype is bool.

Supported Platforms:

Ascend GPU CPU

Examples

>>> x = (Tensor(np.array([np.log(-1), 1, np.log(0)])), Tensor(np.array([1.0]))
>>> output = amp.all_finite(x)