Solved by ptrblck in post #7 
              
              
                .to() was introduces in PyTorch 0.4.0 if I’m not mistaken. 
If you’re using an older version, you might want to update to the latest release. 
You can find the instructions here.