I did not change the model, the model is created in the code below
print("=> creating model '{}'".format(args.arch))
        model = models.__dict__[args.arch]()

and because this problem happens sometimes, and sometimes not. Now, it seems to work fine, therefore, I will update the error message if I meet nan again. Thanks very much! @ptrblck @ZdsAlpha