code wiki / _hdl_build / nx_fnet_train_gate.nx
nx_fnet_train_gate.nx
buildroot/runtime/_hdl_build/nx_fnet_train_gate.nx
about
nx_fnet_train_gate.nx -- GATE for FNET-003: the trainable FNet block (arc convergence). Proves, by RUNNING:
G1 f32 FFT correctness: the f32 radix-2 FFT equals the naive O(n^2) f32 DFT (same CORDIC->f32 twiddles)
at n=8 -- the f32 transform is a real Fourier transform.
G2 FNet-op GRADCHECK through the autograd: x[4,4] -> ta_fnet -> mse(.,target); analytic gradient (the
self-adjoint backward, dx = fnet_mix(dL/dy)) vs central finite difference per input cell (h=1/128,
rel<1/32 floor 1/64). Proves the sub-quadratic mixer is now a correctly-differentiable tape op.
G3 TRAIN through the op: gradient descent on the input to minimize mse(fnet(x), target) -- the loss
strictly decreases, so gradients flow end-to-end through the FNet block.
Evidence -> knowledge/status/fnet_train.log (FNETTRAINGATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL
dependencies 2 imports · 0 importers
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
structs
| none |
consts
| 14 | const FT_LOG: *u8 = "knowledge/status/fnet_train.log" |
functions
| 16 | func ft_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 } |
| 17 | func ft_wn(fd: i64, v: i64) -> i64 |
| 29 | func ft_dft(in_re: *i64, in_im: *i64, n: i64, out_re: *i64, out_im: *i64) -> i64 |
| 50 | func g_fnet_build(tape: *i64, vals: *i64, st: *i64, x: *i64, target: *i64, xnout: *i64) -> i64 |
| 59 | func g_fnet_loss(tape: *i64, vals: *i64, st: *i64, x: *i64, target: *i64) -> i64 |
| 64 | func g_fnet_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, x: *i64, target: *i64, dx: *i64) -> i64 |
| 73 | func main() -> i64 |