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

Accumulate gradients is not compatible with BatchNorm #75

Closed
raphaelreinauer opened this issue May 5, 2022 · 1 comment
Closed

Accumulate gradients is not compatible with BatchNorm #75

raphaelreinauer opened this issue May 5, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request low priority This issue is a nice to have

Comments

@raphaelreinauer
Copy link
Collaborator

When I use n_accumulated_grads with a value bigger than 1 with batch norm layers, the batch normalization is computed only over the micro-batches and not the whole batch. This could cause problems with training stability and validation results.

I think that batch norm layers should be treated specially to compute the mean and variance over the whole batch finally. I think this is a very hard problem and I don't have a solution. Maybe it would be good to look at how they're doing it in the Pytorch-lightning library.

@raphaelreinauer raphaelreinauer added the bug Something isn't working label May 5, 2022
@matteocao matteocao added enhancement New feature or request and removed bug Something isn't working labels May 8, 2022
@matteocao matteocao changed the title [BUG] Accumulate gradients is not compatible with BatchNorm Accumulate gradients is not compatible with BatchNorm May 8, 2022
@matteocao matteocao added this to the Giotto-deep release milestone May 8, 2022
@matteocao matteocao added the low priority This issue is a nice to have label May 8, 2022
@raphaelreinauer
Copy link
Collaborator Author

This is no longer relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority This issue is a nice to have
Projects
None yet
Development

No branches or pull requests

2 participants