Skip to content

Conversation

@yangchris11
Copy link
Contributor

@yangchris11 yangchris11 commented May 25, 2020

p.add_(-lr, p.grad) throws RuntimeError: a leaf Variable that requires grad is being used in an in-place operation, using p.data.add_(-lr, p.grad) fixes this issue.

p.add_(-lr, p.grad) throws RuntimeError: a leaf Variable that requires grad is being used in an in-place operation, using p.data.add_(-lr, p.grad) fixes this issue.
@yangchris11 yangchris11 changed the title Fix grad in-place operation [word_language_model] Fix grad in-place operation May 25, 2020
@soumith soumith merged commit 984700d into pytorch:master May 27, 2020
@soumith
Copy link
Member

soumith commented May 27, 2020

thanks!

@YYStreet
Copy link
Contributor

Please also fix this line https://github.com/pytorch/examples/blob/master/regression/main.py#L60.

Same issue

@YYStreet
Copy link
Contributor

Please also fix this line https://github.com/pytorch/examples/blob/master/regression/main.py#L60.

Same issue

Create a PR #781

YinZhengxun pushed a commit to YinZhengxun/mt-exercise-02 that referenced this pull request Mar 30, 2025
p.add_(-lr, p.grad) throws RuntimeError: a leaf Variable that requires grad is being used in an in-place operation, using p.data.add_(-lr, p.grad) fixes 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

Successfully merging this pull request may close these issues.

3 participants