It’s very strange, I met the same situation like you.I trian VGG16 with datasets CIFAR-10 in ubuntu16.04 and after first backward and step, I get a loss NAN and grad is also NAN. Then I try to change VGG16 layer like modify the parameters in nn.Linear(in,out), but I found when I change original FC layer from nn.Linear(4096,num_classes =10) to nn.Linear(4096,293),it works and no NAN. And delete all FC layer of VGG16, it still works well. After checking my numpy version(1.18.1),  I update numpy to the latest version 1.19.2.Wow !!! no more Nan exsit in my experiment !!!  I still don’t understand why this problem happens in ubuntu not Windows