Model runs fine on Mac but not on Linux (both CPU and GPU problems)

The same code runs fine on Mac but not on Linux. I am using the same version of PyTorch.

I have also put up the issue on PyTorch Github page. Please see the details here:

dont create duplicate posts. either open a github issue or write on the forum.