Batch Norm by Hand
Do what batch normalization does to a batch while training. For each column of x: subtract the mean of the column, divide by the square root of its variance plus eps (the variance that divides by the number of rows), then multiply by that column's entry of gamma and add its entry of beta. Return the result.
Example 1
x [[1.0,10.0],[3.0,30.0]]
gamma [1.0,1.0]
beta [0.0,0.0]
eps 1e-05
returns [[-1.0,-1.0],[1.0,1.0]]
Constraints
- 2 to 6 rows, 1 to 3 columns
gammaandbetahave one number per column
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.