8000 [PyTorch] fix(Batch Normalization): memory leaky by mzz2017 · Pull Request #1342 · d2l-ai/d2l-en · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[PyTorch] fix(Batch Normalization): memory leaky #1342

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

Merged
merged 2 commits into from
Aug 15, 2020
Merged

[PyTorch] fix(Batch Normalization): memory leaky #1342

merged 2 commits into from
Aug 15, 2020

Conversation

mzz2017
Copy link
Contributor
@mzz2017 mzz2017 commented Aug 13, 2020

The memory would not be freed and accumulate every epochs to explode finally.

X is associated with moving_mean and moving_var via gradient computation.

As the result, X will not be freed due to the resident of self.moving_mean and self.moving_var in memory.

Thus the returning values here should be modified to moving_mean.data and moving_var.data to remove the gradient property, which will not impact our model.

@mzz2017
Copy link
Contributor Author
mzz2017 commented Aug 13, 2020

I just modified the code in pytorch version.
Please check and update it if there is the same problem in mxnet and tensorflow, thanks.

@mli
Copy link
Member
mli commented Aug 13, 2020

Job d2l-en/PR-1342/2 is complete.
Check the results at http://preview.d2l.ai/d2l-en/PR-1342/

@mzz2017 mzz2017 closed this Aug 13, 2020
@mzz2017 mzz2017 reopened this Aug 13, 2020
@mli
Copy link
Member
mli commented Aug 13, 2020

Job d2l-en/PR-1342/3 is complete.
Check the results at http://preview.d2l.ai/d2l-en/PR-1342/

@astonzhang astonzhang changed the title fix(Batch Normalization): memory leaky [PyTorch] fix(Batch Normalization): memory leaky Aug 13, 2020
@mli
Copy link
Member
mli commented Aug 13, 2020

Job d2l-en/PR-1342/4 is complete.
Check the results at http://preview.d2l.ai/d2l-en/PR-1342/

@astonzhang astonzhang requested review from AnirudhDagar and removed request for AnirudhDagar August 14, 2020 23:54
Copy link
Member
@AnirudhDagar AnirudhDagar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Nice catch! @mzz2017

@AnirudhDagar AnirudhDagar merged commit 43f50e7 into d2l-ai:master Aug 15, 2020
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
0