has_nan

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

Test if any of x contains a NAN

Parameters

x (Tensor) – The Tensor 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

Tensor

Examples

import paddle
data = paddle.randn(shape=[2,3], dtype="float32")
res = paddle.fluid.layers.has_nan(data)
# [False]