arnab39 / Semi-supervised-segmentation-cycleGAN

Pytorch implementation of our paper: Revisting Cycle-GAN for semi-supervised segmentation
MIT License
103 stars 18 forks source link

RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn #14

Open Rainfor1 opened 4 years ago

Rainfor1 commented 4 years ago

Hello, arnab39! I have a problem for you. When I run main.py, but I get this error:

Traceback (most recent call last): File "main.py", line 88, in main() File "main.py", line 73, in main model.train(args) File "/home/lix/Documents/code/Semi-supervised-segmentation-cycleGAN/model.py", line 443, in train gen_loss.backward() File "/home/lix/miniconda3/envs/ptseg/lib/python3.6/site-packages/torch/tensor.py", line 107, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/home/lix/miniconda3/envs/ptseg/lib/python3.6/site-packages/torch/autograd/init.py", line 93, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

How can I solve this problem? I am looking forward for your reply! Thanks!

ReverseSystem001 commented 4 years ago

do you solve this problem now?