Folding Batch Norm into a Linear Layer

medium
Unit 20 · Inference0/2 to milestone

At inference, batch norm uses fixed running statistics, so it's just an affine transform and can be folded into the preceding layer:

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Folding Batch Norm into a Linear Layer · TechGradify