Skip to main content

package nn

Package nn is the module-system floor over the clikart tensor surface: Module, Linear, Sequential.

mlp := nn.NewSequential(
nn.NewLinear(w1, b1, &relu),
nn.NewLinear(w2, b2, nil),
)
y, err := mlp.Forward(x) // x stays valid (non-consuming)
mlp.Close() // drops the layers' weight references

Every Forward is non-consuming (the retain-before-consuming-op mechanism inside the typed wrappers): inputs stay valid and stay the caller's to release.

NameKind
Lineartype
Moduletype
Sequentialtype