isposinf

paddle. isposinf ( x, name=None ) [source]

Tests if each element of input is positive infinity or not.

Parameters
  • x (Tensor) – The input Tensor. Must be one of the following types: bfloat16, float16, float32, float64, int8, int16, int32, int64, uint8.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

out (Tensor), The output Tensor. Each element of output indicates whether the input element is positive infinity or not.

Examples

>>> import paddle
>>> paddle.set_device('cpu')
>>> x = paddle.to_tensor([-0., float('inf'), -2.1, -float('inf'), 2.5], dtype='float32')
>>> res = paddle.isposinf(x)
>>> print(res)
Tensor(shape=[5], dtype=bool, place=Place(cpu), stop_gradient=True,
[False, True, False, False, False])