Skip to content

count running_mean and running_var params for BN - #88

Open
mostafaelhoushi wants to merge 2 commits into
sksq96:masterfrom
mostafaelhoushi:patch-1
Open

count running_mean and running_var params for BN#88
mostafaelhoushi wants to merge 2 commits into
sksq96:masterfrom
mostafaelhoushi:patch-1

Conversation

@mostafaelhoushi

Copy link
Copy Markdown

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

Naireen commented Jan 2, 2020

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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