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

RuntimeError when training image-wise network #10

Open
CaelynCheung1996 opened this issue Apr 15, 2020 · 1 comment
Open

RuntimeError when training image-wise network #10

CaelynCheung1996 opened this issue Apr 15, 2020 · 1 comment

Comments

@CaelynCheung1996
Copy link

I encountered this problem when running in mode "0" to train image-wise network after done training patch-wise one.
Traceback (most recent call last):
File "train.py", line 18, in
iw_model.train()
File "/home/xiaohui8/SR/ICIAR2018/src/models.py", line 300, in train
loss.backward()
File "/home/xiaohui8/miniconda3/envs/pytorch-CycleGAN-and-pix2pix/lib/python3.5/site-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/xiaohui8/miniconda3/envs/pytorch-CycleGAN-and-pix2pix/lib/python3.5/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

@CaelynCheung1996
Copy link
Author

CaelynCheung1996 commented Apr 15, 2020

I encountered this problem when running in mode "0" to train image-wise network after done training patch-wise one.
Traceback (most recent call last):
File "train.py", line 18, in
iw_model.train()
File "/home/xiaohui8/SR/ICIAR2018/src/models.py", line 300, in train
loss.backward()
File "/home/xiaohui8/miniconda3/envs/pytorch-CycleGAN-and-pix2pix/lib/python3.5/site-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/xiaohui8/miniconda3/envs/pytorch-CycleGAN-and-pix2pix/lib/python3.5/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

I change nn.Dropout(inplace=True) to nn.Dropout()
And it works. Chain of inplace=True is not allowed in PyTorch

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

1 participant