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: A view was created in no_grad mode and is being modified inplace with grad mode enabled. This view is the output of a function that returns multiple views. Such functions do not allow the output views to be modified inplace. You should replace the inplace operation by an out-of-place one #25

Open
rutuja1409 opened this issue May 2, 2021 · 4 comments

Comments

@rutuja1409
Copy link

rutuja1409 commented May 2, 2021

Hello @Jakaria08 I'm getting this error. Can you help me solve this ?

21-05-02 10:35:50.553 - INFO: Total epochs needed: 736 for iters 400,000
2021-05-02 10:35:50.717038: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
21-05-02 10:35:51.840 - INFO: Start training from epoch: 0, iter: 0
Traceback (most recent call last):
File "/content/drive/MyDrive/Project/EESRGAN/train.py", line 94, in
main(config)
File "/content/drive/MyDrive/Project/EESRGAN/train.py", line 73, in main
trainer.train()
File "/content/drive/MyDrive/Project/EESRGAN/trainer/cowc_GAN_FRCNN_trainer.py", line 83, in train
self.model.optimize_parameters(current_step)
File "/content/drive/MyDrive/Project/EESRGAN/model/ESRGAN_EESN_FRCNN_Model.py", line 234, in optimize_parameters
loss_dict = self.netFRCNN(self.intermediate_img, self.targets)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torchvision/models/detection/generalized_rcnn.py", line 78, in forward
images, targets = self.transform(images, targets)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torchvision/models/detection/transform.py", line 110, in forward
images = self.batch_images(images)
File "/usr/local/lib/python3.7/dist-packages/torchvision/models/detection/transform.py", line 215, in batch_images
pad_img[: img.shape[0], : img.shape[1], : img.shape[2]].copy
(img)

Above is the error i'm getting. Can you help me ?

@Githopp
Copy link

Githopp commented Aug 17, 2021

For me Pytorch 1.1.0 solved these error (check requirements.txt).

@KZGSK
Copy link

KZGSK commented Oct 23, 2021

@rutuja1409 Were you able to fix this issue? I'm getting the same error.

@YanADingggg
Copy link

Hello, may I ask if you have solved this problem? Now I have the same problem and I would like to ask for help. Thank you very much @weichen5926 @rutuja1409 @Githopp

@KZGSK
Copy link

KZGSK commented Dec 7, 2021

Hi, I'm sorry to reply you so late.I think it's a Pytorch version problem. For me Pytorch1.2 and 1.10 solved these error. But,you can change "self.intermediate_img = self.final_SR" to“self.intermediate_img = self.final_SR.detach()”.In this way, no error can be reported,but there may be potential problems.I didn't continue to verify. Good luck! @YanADingggg

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

4 participants