code wiki / _hdl_build / nx_fnet_grad_gate.nx
nx_fnet_grad_gate.nx
buildroot/runtime/_hdl_build/nx_fnet_grad_gate.nx
about
nx_fnet_grad_gate.nx -- GATE for FNET-002: the FNet mixer's backward pass (VJP). Proves, by RUNNING, that
the mixer is SELF-ADJOINT, so dL/dx = fnet_mix(dL/dy) -- backprop is one forward mix, zero stored
activations, zero parameters. Three independent proofs (n=8, d=4 -> a 32-dim operator):
G1 SYMMETRY extract the operator matrix M by impulse responses (M[:,k] = fnet_mix(S*e_k)); the
real-linear FNet operator must be SYMMETRIC (A = A^T) because it is the real part of a
Kronecker product of symmetric DFT matrices. Measure max|M[i,j]-M[j,i]|.
G2 ADJOINT TEST the relationship backprop relies on: <A x, g> == <x, A* g> with A* = A. Measure
|<Ax,g> - <x,Ag>| -- zero (to rounding) IFF using fnet_mix as the backward is the
correct VJP.
G3 GRADCHECK finite-difference the scalar loss L(x)=sum a*fnet_mix(x): central differences vs the
analytic backward fnet_mix_backward(a). Max |fd - analytic|.
All three are robust to the Q14 fixed-point rounding (tolerances are a small % of signal, actuals reported).
Evidence -> knowledge/status/fnet_grad.log (FNETGRADGATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_fnet_mix.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
| 19 | const FG_LOG: *u8 = "knowledge/status/fnet_grad.log" |
functions
| 21 | func fg_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 } |
| 22 | func fg_wn(fd: i64, v: i64) -> i64 |
| 32 | func fg_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } called by 1: main |
| 35 | func fg_forward(src: *i64, n: i64, d: i64, out: *i64) -> i64 |
| 49 | func main() -> i64 |