Hi,
From version 1.8.1, torch.nan_to_num — PyTorch 1.8.1 documentation 95 is now available. It replaces NaN , positive infinity, and negative infinity values in input with the values specified by nan , posinf , and neginf , respectively.