isinf
- paddle. isinf ( x: Tensor, name: str | None = None ) Tensor [source]
-
Return whether every element of input tensor is +/-INF or not.
Note
Alias Support: The parameter name
input
can be used as an alias forx
. For example,isinf(input=tensor_x)
is equivalent toisinf(x=tensor_x)
.- Parameters
-
x (Tensor) – The input tensor, it’s data type should be float16, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128. alias:
input
.name (str|None, optional) – Name for the operation (optional, default is None). For more information, please refer to api_guide_Name.
- Returns
-
Tensor, the bool result which shows every element of x whether it is +/-INF or not.
Examples
>>> # type: ignore >>> import paddle >>> x = paddle.to_tensor([float('-inf'), -2, 3.6, float('inf'), 0, float('-nan'), float('nan')]) >>> out = paddle.isinf(x) >>> out Tensor(shape=[7], dtype=bool, place=Place(cpu), stop_gradient=True, [True , False, False, True , False, False, False])