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

In the example, logits needs requires_grad=True #4

Open
aaronrmm opened this issue May 17, 2022 · 0 comments
Open

In the example, logits needs requires_grad=True #4

aaronrmm opened this issue May 17, 2022 · 0 comments

Comments

@aaronrmm
Copy link

I'm using torch==1.11.0+cu113 and the example for Poly1 Cross-Entropy Loss throws an error RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn.

I just have to change line 7 to logits = torch.rand([batch_size, num_classes], requires_grad=True) for it to work.

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