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

Cannot set requires_grad in deepfool #2

Closed
zhxgj opened this issue Mar 16, 2020 · 2 comments
Closed

Cannot set requires_grad in deepfool #2

zhxgj opened this issue Mar 16, 2020 · 2 comments

Comments

@zhxgj
Copy link

zhxgj commented Mar 16, 2020

The deepfool method fails due the error below

  File "/dccstor/ddig/jbtang/tools/anaconda3/envs/python3/lib/python3.6/site-packages/torchattacks/attacks/deepfool.py", line 29, in forward
    image.requires_grad = True
RuntimeError: you can only change requires_grad flags of leaf variables.
@Harry24k
Copy link
Owner

Harry24k commented Mar 16, 2020

Thank you for noticing me. That error arises because of 'break' in iterations. I solved this error with adding '.detach()' . Please refer b0510b5.

@zhxgj
Copy link
Author

zhxgj commented Mar 17, 2020

Thank you @Harry24k for your quick fix!

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