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

count running_mean and running_var params for BN #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mostafaelhoushi
Copy link

For batch norm layers, count the running_var and running_mean parameters in batch_norm layers

For batch norm layers, count the running_var and running_mean parameters in batch_norm layers
According to https://pytorch.org/docs/stable/_modules/torch/nn/modules/batchnorm.html, we need to check the attribute track_running_stats of batchnorm layer to see if running_mean and running_vars are stored as parameters
@Naireen
Copy link
Collaborator

Naireen commented Jan 2, 2020

This isn't included since running_mean and running_var are what are used to determine what the learnable parameters (in this came beta and gamma). They aren't really learnable parameters.

Here are docs for reference:
https://pytorch.org/docs/stable/nn.html#batchnorm1d

@mostafaelhoushi
Copy link
Author

Thanks @Naireen
According to the link you sent provided, I am quoting the following:

Also by default, during training this layer keeps running estimates of its computed mean and variance, which are then used for normalization during evaluation.

If track_running_stats is set to False, this layer then does not keep running estimates, and batch statistics are instead used during evaluation time as well

So, my understanding is that we do need to store running_mean and running_var parameters if track_running_stats option is set to True.

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.

2 participants