In that case my example code should work.
Have a look at the Training a Classifier tutorial 5 as it might give you a good starting point.
PS: Also, these tutorials 2 are useful to get started with PyTorch