Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing this error: #7

Open
Mayureshdindorkar opened this issue Sep 28, 2024 · 1 comment
Open

Facing this error: #7

Mayureshdindorkar opened this issue Sep 28, 2024 · 1 comment

Comments

@Mayureshdindorkar
Copy link

File "train.py", line 357, in train
loss_adv.backward(retain_graph=True)
File "/u/student/2023/cs23mtech14007/miniconda3/lib/python3.7/site-packages/torch/_tensor.py", line 489, in backward
self, gradient, retain_graph, create_graph, inputs=inputs
File "/u/student/2023/cs23mtech14007/miniconda3/lib/python3.7/site-packages/torch/autograd/init.py", line 199, in backward
allow_unreachable=True, accumulate_grad=True) # 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.cuda.FloatTensor [512, 7]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

Please help!!

@tianweijin123
Copy link

File "train.py", line 357, in train loss_adv.backward(retain_graph=True) File "/u/student/2023/cs23mtech14007/miniconda3/lib/python3.7/site-packages/torch/_tensor.py", line 489, in backward self, gradient, retain_graph, create_graph, inputs=inputs File "/u/student/2023/cs23mtech14007/miniconda3/lib/python3.7/site-packages/torch/autograd/init.py", line 199, in backward allow_unreachable=True, accumulate_grad=True) # 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.cuda.FloatTensor [512, 7]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

Please help!!

May I ask how you solved this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants