Log inStart free
LESSON 5.13 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

BatchNorm and GroupNorm

Watch one tensor normalized two ways: BatchNorm across the batch, GroupNorm within each example.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 5.13 · NORM BAY3 × 4 × 2 TENSOR · BATCH 3
01
Stage 1 of 6 · The activations
The batch holds all 3 examples, with 4 channels at 2 positions each. Channel 4 averages 5.7, channel 2 only 0.2.
Explain it simply

Each small square is one number that a layer passed on. Each block is one example, and each row is one channel. On average, channel 4 sits much higher than channel 2. Training goes faster when every channel sits on a common scale.

Three blocks of 4 rows and 2 columns. 3 of them are in the batch. Channel 4 holds 9.9, 11.0 in example 1.

activations xone setoutput above 0output below 0γ, β, running averages
2.74.41.00.94.34.69.911.01.80.9−2.0−2.5−3.10.12.60.55.56.52.31.67.15.47.82.6the activationsx · activationssetsoutputex 1ex 1ex 1ex 2ex 2ex 2ex 3ex 3ex 3ch 1ch 2ch 3ch 4x: 3 examples × 4 channels × 2 positions2.74.41.00.94.34.69.911.01.80.9−2.0−2.5−3.10.12.60.55.56.52.31.67.15.47.82.6the activationsx · activationssetsoutputex 1ex 1ex 1ex 2ex 2ex 2ex 3ex 3ex 3ch 1ch 2ch 3ch 4x: 3 examples × 4 channels × 2 positions
Toy: a 3 × 4 × 2 tensor, seeded, 1 decimal
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
xn,c,l\sy{x}{data}{x_{n,c,l}}
x∈R3×4×2x \in \mathbb{R}^{3 \times 4 \times 2}

Each value has an example n, a channel c and a position l.

Common mix-ups

MYTHBatchNorm treats each example on its own.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Under BatchNorm, what happens to example 1's normalized values with a batch of 1?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.