Created
June 26, 2026 09:34
-
-
Save hamidb80/c8a5ad4ef27d45da9123bcd7fab68aea to your computer and use it in GitHub Desktop.
BQN BatchNorm and LayerNorm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ZScore ← { | |
| avg ← (+´÷≠) 𝕩 | |
| var ← (≠𝕩) ÷˜ +´ ט 𝕩-avg | |
| eps ← 0.000001 | |
| (𝕩-avg)÷(eps + √var) | |
| } | |
| LayerNorm ← { ZScore ˘ 𝕩} | |
| BatchNorm ← {⍉ZScore ˘ ⍉𝕩} | |
| # ------------------------------ | |
| df ← ↑‿4 ⥊ [ | |
| 1.0, 2.0, 3.0, 4.0 | |
| 10.0, 20.0, 30.0, 40.0 | |
| 0.0, 0.0, 0.0, 0.0 ] | |
| ZScore [1.0, 2.0, 3.0, 4.0] | |
| LayerNorm df | |
| BatchNorm df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment