code wiki / _hdl_build / nx_fnet_train_gate.nx

nx_fnet_train_gate.nx

buildroot/runtime/_hdl_build/nx_fnet_train_gate.nx

8171 B189 linesdepth 6pulls 15 transitivereach 0 importersview sourcekind gate/prooftopic fnet
docsdependenciesstructsconstsfunctions

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

nx_autograd_tensor.nx nx_syscalls.nx nx_fnet_train_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 fftf_twiddles fftf_q16_to_f32 nx_f32_div ↻ nx_i32_to_f32 ↻ fx_cos fx_sin_cos fx_normalize_angle fx_cordic_atan fx_sin fx_sin_cos ↻ fftf_fwd nx_fft_log2 nx_fft_bit_reverse nx_f32_sub nx_f32_add nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_neg nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_add ↻ ft_dft fftf_q16_to_f32 ↻ nx_f32_add ↻

structs

none

consts

14const FT_LOG: *u8 = "knowledge/status/fnet_train.log"

functions

16func 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 }
called by 1: main calls 1: sys_write
17func ft_wn(fd: i64, v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
29func ft_dft(in_re: *i64, in_im: *i64, n: i64, out_re: *i64, out_im: *i64) -> i64
50func g_fnet_build(tape: *i64, vals: *i64, st: *i64, x: *i64, target: *i64, xnout: *i64) -> i64
59func g_fnet_loss(tape: *i64, vals: *i64, st: *i64, x: *i64, target: *i64) -> i64
called by 1: main calls 3: sys_mmapg_fnet_buildta_val
64func g_fnet_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, x: *i64, target: *i64, dx: *i64) -> i64
73func main() -> i64