isfinite

paddle.fluid.layers.tensor. 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 (Tensor) – The Tensor to be checked.

Returns

The tensor storing the output, contains a bool value.

Return type

Tensor

Examples

import paddle

x = paddle.rand(shape=[4, 6], dtype='float32')
y = paddle.fluid.layers.isfinite(x)
print(y)