chenqi1126 / SIPE

[CVPR 2022] Self-supervised Image-specific Prototype Exploration for Weakly Supervised Semantic Segmentation
MIT License
73 stars 10 forks source link

Error found while running “$ python train_resnet50_SIPE.py” code #1

Closed Elaineok closed 2 years ago

Elaineok commented 2 years ago

File "train_resnet50_SIPE.py", line 191, in train() File "train_resnet50_SIPE.py", line 145, in train losses.backward() File "/home/xjt/anaconda3/envs/xjt/lib/python3.6/site-packages/torch/tensor.py", line 221, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/home/xjt/anaconda3/envs/xjt/lib/python3.6/site-packages/torch/autograd/init.py", line 132, in backward allow_unreachable=True) # allow_unreachable flag

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [16, 21, 32, 32]], which is output 0 of GatherBackward, is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

Can you provide me with the modification plan?

chenqi1126 commented 2 years ago

Hi @jingtingxu369, thanks for your attention. We update the code of 'train_resnet50_SIPE.py': https://github.com/chenqi1126/SIPE/blob/ec2e5b9cd7eb23b58ddcbaf957eee0ca851855e6/train_resnet50_SIPE.py#L151