torch.isinf¶
-
torch.
isinf
()¶ Returns a new tensor with boolean elements representing if each element is +/-INF or not. Complex values are infinite when their real and/or imaginary part is infinite.
- Arguments:
tensor (Tensor): A tensor to check
- Returns:
Tensor:
A torch.Tensor with dtype torch.bool
containing a True at each location of +/-INF elements and False otherwise
Example:
>>> torch.isinf(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')])) tensor([False, True, False, True, False])