Welvet examples
29. runtime/forward
Part: IV · Runtime
Package: github.com/openfluke/welvet/runtime/forward
Status: ok — ✅
When
Walking a Grid/Stack with the shared runtime/forward path.
Where
import "github.com/openfluke/welvet/runtime/forward"
cd 29-forward && source ../env.sh && go run .
Why
A grid of heterogeneous ops needs one walker that dispatches by concrete type and fails loudly on unknowns.
What
Forward[T](grid, input) → Result tape; Cell[T] for single-cell dispatch. Covers Dense…Residual + extended wired ops.
Sample output (captured)
true <nil>
Live capture from go run ./cmd/runall on local ../../welvet (exit 0).
Source
Copied from the Welvet feature book examples (openfluke.github.io/welvet/examples/29-forward).
main.go
Download source ↓package main
import (
"fmt"
"github.com/openfluke/welvet/architecture"
"github.com/openfluke/welvet/core"
"github.com/openfluke/welvet/layers/dense"
"github.com/openfluke/welvet/runtime/forward"
)
func main() {
g := architecture.NewGrid(1, 1, 1, 1)
l, _ := dense.New(8, 8, core.ActivationLinear, core.DTypeFloat32)
_ = dense.Place(g, 0, 0, 0, 0, l)
res, err := forward.Forward(g, core.NewTensor[float32](1, 8))
fmt.Println(res != nil, err)
}