has_nan

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

Test if any of x contains a NAN

Parameters

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

Returns

The tensor variable storing the output, only a bool value, indicating that whether there is NAN in x or not.

Return type

Variable

Examples

import paddle.fluid as fluid
data = fluid.layers.data(name="input", shape=[4, 32, 32], dtype="float32")
res = fluid.layers.has_nan(data)