Solved by RaLo4 in post #2 
              
              
                Unfortunately I cannot reproduce the issue. 
No matter how often I try I never get nan 
This might be a version problem. 
It tried it on: 
CUDA 10.2 / Pytorch1.8.1 
as well as on: 
CUDA 10.2 / Pytorch1.9.0 
What are you using?