Exists in numpy: https://docs.scipy.org/doc/numpy/reference/generated/numpy.isinf.html (https://docs.scipy.org/doc/numpy/reference/generated/numpy.isfinite.html) and tensorflow https://www.tensorflow.org/api_docs/python/tf/is_inf (https://www.tensorflow.org/api_docs/python/tf/is_finite) Useful for debugging checks like ```python assert not (torch.isnan(x).any() or torch.isinf(x).any()) ``` Much more concise than ```python assert not (torch.isnan(x).any() or x.eq(float('inf')).any() or x.eq(float('-inf')).any()) ```