thank you Tony.
I am confused now, I test the code you used and it works correctly with gpu mode, and my pytorch version is 0.4.1.post2.
I don’t know what’s wrong with my project and it get the wrong result.