Chapter 3
core — types & backends
github.com/openfluke/welvet/core✅
Why it exists
Every polymorphic path needs one place for DType, LayerType, Activation, Backend, Tensor[T], and slim Layer metadata — without QAT morph defaults.
What it is
34 storage dtypes, Numeric generics, Tensor[T], ExecConfig (BackendCPUTiled | BackendSIMD | BackendWebGPU), Activate/ActivateDeriv, and converters for f16/bf16/fp8/fp4.
Go example
Run:
cd welvet/examples/03-core && source ../env.sh && go run .package main
import (
"fmt"
"github.com/openfluke/welvet/core"
)
func main() {
t := core.NewTensor[float32](2, 4)
t.Data[0] = -1
t.Data[0] = core.Activate(t.Data[0], core.ActivationReLU) // 0
cfg := core.ExecConfig{
Backend: core.BackendSIMD,
MultiCore: true,
TileSize: 32,
}
fmt.Println(cfg.Backend.String(), core.ParseDType("bfloat16"), t.Len())
}
Output
simd bfloat16 8