Chapter 20
layers/cnn1 · cnn2 · cnn3
github.com/openfluke/welvet/layers/cnn2✅
Why it exists
Conv nets must sit on the same dtype×quant×backend matrix as Dense. im2col → Dense GEMV is the intentional first cut.
What it is
cnn1/cnn2/cnn3: host im2col then Proj Dense. Full timed matrices. Tiled conv shaders still ⬜.
Go example
Run:
cd welvet/examples/20-cnn && source ../env.sh && go run .package main
import (
"fmt"
"github.com/openfluke/welvet/core"
"github.com/openfluke/welvet/layers/cnn2"
)
func main() {
l, err := cnn2.New(cnn2.Config{
InChannels: 1, Filters: 4, Height: 8, Width: 8, Kernel: 3, Stride: 1,
})
if err != nil {
panic(err)
}
x := core.NewTensor[float32](1, 1, 8, 8)
_, y, err := cnn2.Forward(l, x)
fmt.Println(y.Shape, err)
}
Output
[1 4 6 6] <nil>