Hi, I am new to Pythorch. This question helped me in solving some doubts. For this reason I wanted to share my notebook which is a clean version of what discussed above. In addition, it automatically understands if you have or not a GPU. I am running everything in google colab and it works well.
You can find the associated notebook here:
https://colab.research.google.com/drive/1Mjk_zqal7YMgGkWzLnhr7tL9wFW_eCCc 22