| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Welcome, to learn more about implementation of Normalization and Regularization using Pytorch, please continue reading patiently.
Lets begin!
Lets understand a bit about the 3 Normalizations that we have used, namely, Batch Normalization, Layer Normalization and Group Normalization.
Consider the following setup
We have two layers with batch size of 4, meaning 4 images in each batch. Each of the 4 2x2 matrices under a layer represent a channel.
Here while calculating mean and variance, its calculated across the individual channels of each batch, which can be seen in the image above highlighted in blocks of same colour. We have 4 means and variances as we have 4 channels, calculations are done for each channel.
For Layer Normalization, we calculate mean and variance across all the channels of the layer, this is highlighted by the red block that spans horizontally across all channels. We have 4 means and variances here as well as we have 4 images and its calculated across all channels of an image.
In Group Normalization, each layer is divided into groups. Mean and variance are calculated for these groups, as highlighted by the dotted rectangles. The channels are grouped, and in our case its grouped into 2s. So we end up with 8 groups in all. And hence we have 8 means and variances.
If you are interested, you can check out the complete implementation of whats explained above in an excel sheet HERE
Lets now move onto the implementation part.
We have used MNIST dataset to implement Normalizations.
Pytorch implementation of our experiment is split across two scripts:
Number of training samples: 60000
Number of test samples: 10000
Abhiram Gurijala
Arijit Ganguly
Rohin Sequeira
| Back | FazBrowse Home | New Git URL |