ML Katas

Batch Normalization From Scratch

hard (>1 hr) pytorch implementation batchnorm deep learning
this month by E

Implement 1D batch normalization manually (without using nn.BatchNorm1d). Steps:

  1. Compute batch mean and variance.
  2. Normalize inputs.
  3. Scale and shift with learnable γ,β.

Compare with PyTorch's built-in BatchNorm1d on random input.