How to set 'nan' in Tensor to 0

See discussion in ReLU turns nan into zeros. As of pytorch 4.1 ReLU can’t be used for this anymore though. I’ve asked about it there.