I try to run train.py,then error happen.Can anyone help?
Traceback (most recent call last):
File "D:\Program Files (x64)\PyCharm 2021.1.3\plugins\python\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\Program Files (x64)\PyCharm 2021.1.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "F:/20220410_BDRAR-master/train1.py", line 149, in
main()
File "F:/20220410_BDRAR-master/train1.py", line 78, in main
train(net, optimizer)
File "F:/20220410_BDRAR-master/train1.py", line 117, in train
loss.backward()
File "D:\anaconda3\envs\BDRAR\lib\site-packages\torch\tensor.py", line 245, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File "D:\anaconda3\envs\BDRAR\lib\site-packages\torch\autograd__init__.py", line 147, in backward
allow_unreachable=True, accumulate_grad=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 8, 128, 128]], which is output 0 of ReluBackward1, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
python-BaseException
I try to run train.py,then error happen.Can anyone help?
Traceback (most recent call last): File "D:\Program Files (x64)\PyCharm 2021.1.3\plugins\python\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "D:\Program Files (x64)\PyCharm 2021.1.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "F:/20220410_BDRAR-master/train1.py", line 149, in
main()
File "F:/20220410_BDRAR-master/train1.py", line 78, in main
train(net, optimizer)
File "F:/20220410_BDRAR-master/train1.py", line 117, in train
loss.backward()
File "D:\anaconda3\envs\BDRAR\lib\site-packages\torch\tensor.py", line 245, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
File "D:\anaconda3\envs\BDRAR\lib\site-packages\torch\autograd__init__.py", line 147, in backward
allow_unreachable=True, accumulate_grad=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 8, 128, 128]], which is output 0 of ReluBackward1, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
python-BaseException