How to set 'nan' in Tensor to 0

Hi @Chen-Wei_Xie,

torch.isnan() was implemented earlier this year. So now you can set the NaN’s to 0’s using my_tensor[torch.isnan(my_tensor)] = 0

Cheers

11 Likes