code wiki / _hdl_build / nx_train_r3_gate.nx

nx_train_r3_gate.nx

buildroot/runtime/_hdl_build/nx_train_r3_gate.nx

13865 B292 linesdepth 6pulls 16 transitivereach 0 importersview sourcekind gate/prooftopic train
docsdependenciesstructsconstsfunctions

about

nx_train_r3_gate.nx -- GATE for TRAIN-R3 (T7): softmax + cross-entropy + nonlinear training. Proves, by RUNNING: A GRADCHECK the new ops: softmax-cross-entropy (dlogits = softmax - onehot) AND standalone softmax (Jacobian-vector product), analytic vs central finite difference (h=1/128, rel<1/32 floor 1/64). B TRAIN A NONLINEAR CLASSIFIER -- XOR: a 2->8(relu)->2 MLP with a softmax-CE head and a DETERMINISTIC symmetry-breaking init, trained by AdamW. XOR is the canonical proof that a LINEAR model CANNOT solve it -- reaching 4/4 correct demonstrates real nonlinear learning. Assert accuracy==4 AND loss decreased. C BIT-EXACT: train twice from the same init -> identical final bits for all 42 parameters. Evidence -> knowledge/status/train_r3.log (TRAINR3GATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_autograd_tensor.nx nx_syscalls.nx nx_gate_verdict.nx nx_train_r3_gate.nx

imports: nx_autograd_tensor.nxnx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ ta_constf nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 g_gc3 sys_mmap ↻ g_softce_grads ta_leaf ta_new ta_softce ta_new ↻ nx_f32_gt nx_f32_lt nx_f32_is_nan nx_f32_is_zero nx_f32_add nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻

structs

none

consts

14const T3_LOG: *u8 = "knowledge/status/train_r3.log"

functions

16func t3_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main calls 1: sys_write
17func t3_wn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
29func g_softce_loss(tape: *i64, vals: *i64, st: *i64, lg: *i64, tg: *i64) -> i64
called by 1: g_gc3 calls 3: ta_leafta_softceta_val
36func g_softce_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, lg: *i64, tg: *i64, gout: *i64) -> i64
46func g_smax_loss(tape: *i64, vals: *i64, st: *i64, x: *i64, tg: *i64) -> i64
called by 1: g_gc3 calls 4: ta_leafta_softmaxta_mseta_val
54func g_smax_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, x: *i64, tg: *i64, gout: *i64) -> i64
66func g_gc3(tape: *i64, vals: *i64, grads: *i64, st: *i64, base: *i64, tg: *i64, kind: i64, worst: *i64) -> i64
100func g_xor_build(tape: *i64, vals: *i64, st: *i64, p: *i64, xs: *i64, ts: *i64, c4: *i64, wb: *i64) -> i64
122func g_read42(tape: *i64, grads: *i64, wb: *i64, g: *i64) -> i64
called by 1: g_xor_train calls 1: ta_grad
133func g_xor_predict(tape: *i64, vals: *i64, st: *i64, p: *i64, xs: *i64, s: i64) -> i64
146func g_xor_init(p: *i64) -> i64
called by 1: g_xor_train calls 1: ta_constf
156func g_xor_train(tape: *i64, vals: *i64, grads: *i64, st: *i64, xs: *i64, ts: *i64, epochs: i64, pout: *i64, lf: *i64, ll: *i64) -> i64
202func main() -> i64