Pytorch Crush using backward with exit code -1073741819 (0xC0000005)


I am trying to use DCGAN with DCGAN TUTORIAL:
But there occurs an error: Process finished with exit code -1073741819 (0xC0000005) During loss.backward() running.

To Reproduce

My problem is I can only train it on CPU. It raises an error when I try to train it on GPU.And my cuda is available.
Here is the error.

Preformatted textProcess finished with exit code -1073741819 (0xC0000005)

the code is here


My environment is python3.6.9 windows10 torch1.2.0. cuda9.2

Please help solve this, thanks a lot.

Duplicate of Please Help me solve this error Process finished with exit code -1073741819 (0xC0000005)