code wiki / _hdl_build / nx_train_r3_gate.nx

nx_train_r3_gate.nx

buildroot/runtime/_hdl_build/nx_train_r3_gate.nx

13331 B284 linesdepth 6pulls 15 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 2 imports · 0 importers

nx_autograd_tensor.nx nx_syscalls.nx nx_train_r3_gate.nx

imports: nx_autograd_tensor.nxnx_syscalls.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 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 ↻ nx_f32_exp_field ↻ nx_f32_exp nx_f32_classify ↻ nx_f32_sign ↻ _f32_to_i32_rne nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_exp_field ↻ nx_f32_mant_field ↻ nx_i32_to_f32 ↻ _f32_ldexp nx_f32_classify ↻ nx_f32_exp_field ↻ nx_f32_sign ↻

structs

none

consts

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

functions

15func 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
16func t3_wn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
28func 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
35func g_softce_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, lg: *i64, tg: *i64, gout: *i64) -> i64
45func 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
53func g_smax_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, x: *i64, tg: *i64, gout: *i64) -> i64
65func g_gc3(tape: *i64, vals: *i64, grads: *i64, st: *i64, base: *i64, tg: *i64, kind: i64, worst: *i64) -> i64
99func g_xor_build(tape: *i64, vals: *i64, st: *i64, p: *i64, xs: *i64, ts: *i64, c4: *i64, wb: *i64) -> i64
121func g_read42(tape: *i64, grads: *i64, wb: *i64, g: *i64) -> i64
called by 1: g_xor_train calls 1: ta_grad
132func g_xor_predict(tape: *i64, vals: *i64, st: *i64, p: *i64, xs: *i64, s: i64) -> i64
145func g_xor_init(p: *i64) -> i64
called by 1: g_xor_train calls 1: ta_constf
155func g_xor_train(tape: *i64, vals: *i64, grads: *i64, st: *i64, xs: *i64, ts: *i64, epochs: i64, pout: *i64, lf: *i64, ll: *i64) -> i64
201func main() -> i64