I made a wrong description about this problem before. It should be  pytorch 0.1.12, not  pytorch 0.1.2
Recently, I test it again. The code run correctly with pytorch 0.1.12 but cause the freezing of PyTorch 0.2.0_1 and  PyTorch 0.2.0_2 .