LOOM AI Framework
Deterministic, CPU-first neural runtime with WebGPU acceleration. One JSON model format across Go, TypeScript/JavaScript, Python, C#, C-ABI, and WASM. Identical outputs across every platform.
Open source at
github.com/openfluke/loom
· npm: @openfluke/welvet · PyPI: welvet ·
NuGet: Welvet.
go get github.com/openfluke/loom
Bit-for-bit parity across Go, Python, TypeScript/JS, C#, C, and WASM. CPU-first with optional WebGPU.
Same function names across languages: create, forward, train, save/load, evaluate. One JSON model format.
Dense, Conv2D, Multi-Head Attention, RNN/LSTM, LayerNorm, Residual, RMSNorm, SwiGLU, Softmax (10 variants, MoE).
Fine-grained forward/backward with manual gradient application for online/real-time learning.
import { createNetworkFromJSON, forward } from "@openfluke/welvet";
const model = {
layers: [
{ type: "dense", width: 4, height: 8, activation: "relu" },
{ type: "dense", width: 8, height: 2, activation: "softmax" },
],
};
const net = createNetworkFromJSON(model);
const output = forward(net, [[0.1, 0.2, 0.3, 0.4]]);
console.log("output", output);
from welvet import create_network_from_json, forward
config = {
"layers": [
{"type": "dense", "width": 4, "height": 8, "activation": "relu"},
{"type": "dense", "width": 8, "height": 2, "activation": "softmax"},
]
}
net = create_network_from_json(config)
print(forward(net, [[0.1, 0.5, 0.3, 0.7]]))
package main
import (
"fmt"
"github.com/openfluke/loom"
)
func main() {
layers := []loom.LayerConfig{
{Type: "dense", Width: 4, Height: 8, Activation: "relu"},
{Type: "dense", Width: 8, Height: 2, Activation: "softmax"},
}
net, _ := loom.BuildNetworkFromJSON(layers)
out := loom.ForwardCPU(net, [][]float32{ {0.1, 0.2, 0.3, 0.4} })
fmt.Println(out)
}
from welvet import create_network_from_json, StepState, apply_gradients
net = create_network_from_json({"layers": [{"type": "dense", "width": 4, "height": 2}]})
state = StepState(input_size=4)
for _ in range(100):
state.set_input([0.1, 0.2, 0.3, 0.4])
state.step_forward()
grads = [o - t for o, t in zip(state.get_output(), [0, 1])]
state.step_backward(grads)
apply_gradients(net, lr=0.01)
import { createStepState, train } from "@openfluke/welvet";
const state = createStepState(4);
for (let i = 0; i < 100; i++) {
state.setInput([0.1, 0.2, 0.3, 0.4]);
state.stepForward();
const out = state.getOutput();
state.stepBackward(out.map((v, idx) => v - (idx === 1 ? 1 : 0)));
train(state, { lr: 0.01 });
}