isfinite

paddle.fluid.layers.isfinite(x)[source]

Test if any of x contains an infinity/NAN number. If all the elements are finite, returns true, else false.

Parameters

x (variable) – The Tensor/LoDTensor to be checked.

Returns

The tensor variable storing the output, contains a bool value.

Return type

Variable

Examples

import paddle.fluid as fluid
var = fluid.layers.data(name="data",
                        shape=(4, 6),
                        dtype="float32")
out = fluid.layers.isfinite(var)