megengine.functional.isinf#
- isinf(inp)[source]#
Element-wise
infinity
check.Tests each element \(x_i\) of the input tensor \(x\) to determine whether the element is if equal to positive or negative infinity.
- Parameters:
inp (
Tensor
) – input tensor. Should have a numeric data type.- Return type:
- Returns:
a tensor containing test results. An element out is
True
if \(x_i\) is either positive or negative infinity andFalse
otherwise. The returned array should have a data type of bool.
Examples
>>> F.isinf(Tensor(1)) Tensor(False, dtype=bool, device=xpux:0)
Element-wise isinf:
>>> x = Tensor([1, float("inf"), 0]) >>> F.isinf(x) Tensor([False True False], dtype=bool, device=xpux:0)