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

AttributeError for gradient clipping #1

Open
andrewliao11 opened this issue Apr 11, 2017 · 0 comments
Open

AttributeError for gradient clipping #1

andrewliao11 opened this issue Apr 11, 2017 · 0 comments

Comments

@andrewliao11
Copy link

hi ikostrikov, I got this error when running your code

Traceback (most recent call last):
  File "main.py", line 89, in <module>
    agent.update_parameters(batch)
  File "/home/andrewliao11/Work/pytorch-naf/naf.py", line 121, in update_parameters
    param.grad.data.clamp(-1, 1)
AttributeError: 'NoneType' object has no attribute 'data'

the original code is:

for param in self.model.parameters():
            param.grad.data.clamp(-1, 1)

maybe we should modify in into:

torch.nn.utils.clip_grad_norm(self.model.parameters(), 1)

I'm just a newbie to pytorch, not sure if it's right, thx!

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