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: element 0 of tensors does not require grad and does not have a grad_fn #14

Open
Rainfor1 opened this issue Nov 18, 2019 · 1 comment

Comments

@Rainfor1
Copy link

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
Copy link

do you solve this problem now?

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