zijundeng / BDRAR

Code for the ECCV 2018 paper "Bidirectional Feature Pyramid Network with Recurrent Attention Residual Modules for Shadow Detection"
125 stars 29 forks source link

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation #16

Open CTDou opened 2 years ago

CTDou commented 2 years ago

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

fromsamuel commented 2 years ago

I have encountered the same issue, have you managed to find a solution in the meantime?

wallrue commented 2 years ago

This issue was solved at https://github.com/zijundeng/BDRAR/issues/2