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

torch.grad removed in PyTorch 1.8.1? #8

Closed
jszym opened this issue May 11, 2021 · 2 comments
Closed

torch.grad removed in PyTorch 1.8.1? #8

jszym opened this issue May 11, 2021 · 2 comments

Comments

@jszym
Copy link

jszym commented May 11, 2021

I'm getting the following error with PyTorch 1.8.1

AttributeError: module 'torch' has no attribute 'grad'

Swapping Line 515 for with torch.enable_grad(): seems to resolve the error.

I can't find it in the 1.8 release notes, but it appears torch.grad() might be deprecated? Not sure if anyone else can replicate.

Cheers!

@lessw2020
Copy link
Owner

lessw2020 commented May 11, 2021

Hi @jszym - thanks for the update!
I'm literally upgrading to Pytorch 1.8 as I type...so will see if this is indeed the issue and update if so, though this sounds like a bit of an annoyance to have to check on which version of torch to then determine how to enable grad exactly.
anyway, will find out once I upgrade.
Leaving this open until I can resolve, thanks again for pointing it out!

@lessw2020
Copy link
Owner

ok I also repro this issue with 1.8.1.
In reviewing the torch docs, enable_grad() seems the correct counterpart to the @torch.no_grad() that is used in the overall step function.
I've updated and checked in.
Thanks @jszym for flagging this issue!

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