Solved by richard in post #2 
              
              
                How did you install pytorch? Are you sure you installed the cuda 9 version of it? (You can check this with conda list or something like that). 
Generally hanging happens if there’s a cuda version mismatch between the cuda your pytorch was compiled with and the cuda you’re running.