How to set 'nan' in Tensor to 0

For completness I’ll copy my answer: