Just to make sure, you are running this 28 code and get a constant loss?
Which PyTorch version are you using? If you are using an older version (< 0.4.0), could you wrap your tensors into Variables and run it again?