has_inf

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

Test if any of x contains an infinity number

Parameters

x (Tensor) – The Tensor to be checked.

Returns

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

Return type

Tensor

Examples

import paddle
data = paddle.randn(shape=[4, 32, 32], dtype="float32")
res = paddle.fluid.layers.has_inf(data)
# [False]