I copied your code and only had to change root to root = ‘./data’ because otherwise the access was denied.
But I still get
Epoch: 0, Loss: 2.304852247238159
Epoch: 0, Loss: 2.308029890060425
Epoch: 0, Loss: nan
Epoch: 0, Loss: nan
Epoch: 0, Loss: nan
Epoch: 0, Loss: nan
Epoch: 0, Loss: nan
Epoch: 0, Loss: nan
Epoch: 0, Loss: nan
And I really don’t get it because SGD and ADAM work perfectly fine. And if it is working for you, why not for me.