Chapter 18
layers/sequential
github.com/openfluke/welvet/layers/sequential✅
Why it exists
Some cells need an ordered Dense chain without burning grid hops.
What it is
Dense→Dense compose, or mixed Ops via NewFromOps (Dense, SwiGLU, RMSNorm, LayerNorm). Parallel as a child is parallel.ResidualGraft / a Sandwich — Sequential cannot import parallel.
NewFromOps walks mixed children (Dense, SwiGLU, RMSNorm, LayerNorm) through the same
fwd/bwd as a Dense chain. Parallel is not a Sequential child (import cycle) — wrap F with
parallel.ResidualGraft or put Parallel in a Sandwich. w2a covers mixed Sequential cells;
this is on the v1.0 board, not a leftover “open.”
Go example
examples/18-sequential/main.go
Run:
cd welvet/examples/18-sequential && source ../env.sh && go run .package main
import (
"fmt"
"github.com/openfluke/welvet/core"
"github.com/openfluke/welvet/layers/sequential"
)
func main() {
l, err := sequential.New(sequential.Config{Dim: 16, Depth: 3})
if err != nil {
panic(err)
}
x := core.NewTensor[float32](1, 16)
_, y, err := sequential.Forward(l, x)
fmt.Println(len(y.Data), err)
}
Output
16 <nil>