Solved by ptrblck in post #2 
              
              
                Could you update to the latest stable PyTorch release and retry the code? 
The error message seems fishy, as apparently PyTorch detects the device in the posted script.