Open zztian007 opened 5 months ago
What is the version of your pytorch? This issue appears to be unprecedented.
The pytorch version is 1.13. The python version is 3.8.11
The code was tested with torch = 1.2.0. Could you consider downgrading your PyTorch installation to version 1.2.0 or a version close to it?
or you could change the line loss.backward(torch.ones_like(loss)) to loss = torch.sum(loss) loss.backward()
This might work
When I run train.py in the GMD , it reports the following runtime error. Do I need modify any code of the python files as you provided? How to fix it?
Traceback (most recent call last): File "E:\Projects\PythonProjects\XFVD\Models\GMN\train.py", line 97, in <module> loss.backward(torch.ones_like(loss)) # File "D:\WorkSpace\Anaconda3\envs\python38-tf2\lib\site-packages\torch\_tensor.py", line 487, in backward torch.autograd.backward( File "D:\WorkSpace\Anaconda3\envs\python38-tf2\lib\site-packages\torch\autograd\__init__.py", line 197, in backward Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [20]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).