How to fix the error `Process finished with exit code -1073741819 (0xC0000005)`

4

My problem is when I running FC network the code works well in both CPU and GPU. But when it comes to CNN, I can only train it on CPU. It raises an error when I try to train it on GPU.

Like that:

Process finished with exit code -1073741819 (0xC0000005)

I find the error raised when the code goes to loss.backword. The error happened when I use the first column instead of the second.

device = torch.device("cuda:0")

device = torch.device("cuda:0" if opt.cuda else "cpu")

My environment is Python 3.6.9, Windows 10, Torch 1.2.0, Cuda 9.2.

python
gpu
pytorch
asked on Stack Overflow Oct 11, 2019 by ike杨 • edited Oct 24, 2019 by halfer

1 Answer

1

Finally, I figured out this.

This error occurs just because one of my variables is not loaded in cuda.

When I add this output = Variable(netD(real_cpu),requires_grad=True) the problem solved.

answered on Stack Overflow Oct 11, 2019 by ike杨 • edited Oct 24, 2019 by pppery

User contributions licensed under CC BY-SA 3.0