Chapter 15
layers/layernorm
github.com/openfluke/welvet/layers/layernorm✅
Why it exists
Classic mean+var normalization with γ/β — still required for many HF architectures.
What it is
WebGPU forward; backward host today. Same dtype×quant axes as other weighted layers.
Go example
Run:
cd welvet/examples/15-layernorm && source ../env.sh && go run .package main
import (
"fmt"
"github.com/openfluke/welvet/core"
"github.com/openfluke/welvet/layers/layernorm"
)
func main() {
l, err := layernorm.New(layernorm.Config{Dim: 8})
if err != nil {
panic(err)
}
x := core.NewTensor[float32](1, 8)
_, y, err := layernorm.Forward(l, x)
fmt.Println(len(y.Data), err)
}
Output
8 <nil>