Shortcuts

torch.isinf

torch.isinf(input) → Tensor

Tests if each element of input is infinite (positive or negative infinity) or not.

Note

Complex values are infinite when their real or imaginary part is infinite.

Args:

{input}

Returns:

A boolean tensor that is True where input is infinite and False elsewhere

Example:

>>> torch.isinf(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')]))
tensor([False,  True,  False,  True,  False])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources