Welvet examples
68. Cameral sandwiches + AAI Lucy
Part: VII · Apps
Package: github.com/openfluke/welvet/layers/parallel
Status: ok — ✅ cameral
When
Building or training a net that needs the layers/parallel Op (also usable as a Parallel cam).
Where
import "github.com/openfluke/welvet/layers/parallel"
cd 68-cameral && source ../env.sh && go run .
Why
A single Dense chain cannot host two independent weight copies that share an input, merge, and optionally train under different updates. That is the cameral graph: hemispheres, not screen-space sprites and not a second hidden size.
What
Hemispheres / Bicameral / Sandwich / Mix. Stem → Parallel mid → Dense head. SetBranchModes + TrainStackMSE. Lucy races in AAI (test41 / test48 / test50) import this API; measuring is lucy/; harness is not engine.
Sample output (captured)
mix loss 0 err <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/68-cameral).
main.go
Download source ↓package main
import (
"fmt"
"github.com/openfluke/welvet/core"
"github.com/openfluke/welvet/layers/parallel"
"github.com/openfluke/welvet/quant"
)
func main() {
s, err := parallel.Bicameral(8, 16, 1, core.ActivationLeakyReLU,
core.DTypeFloat32, quant.FormatNone)
if err != nil {
panic(err)
}
hemi := s.Children[1].(*parallel.Layer)
hemi.SetBranchModes(parallel.ModeStepBP, parallel.ModeTweenSplitFastProxy)
x := core.NewTensor[float32](1, 8)
t := core.NewTensor[float32](1, 1)
t.Data[0] = 0.5
loss, err := parallel.TrainStackMSE(s, x, t, parallel.ModeStepBP, 0.01)
fmt.Println("mix loss", loss, "err", err)
}