nx_f32_bn_fold.nx
buildroot/runtime/nx_f32_bn_fold.nx
about
nx_f32_bn_fold.nx -- fold inference BatchNorm into the PRECEDING conv's weights + bias (offline), so a ResNet/
HRNet-class pose net (which uses BN, not GroupNorm) loads straight into the existing dense/grouped f32 conv with
NO runtime BN kernel. For a conv output x = W*in + b followed by BN y = gamma*(x-mean)/sqrt(var+eps) + beta, the
fold is exact per output channel: s = gamma/sqrt(var+eps); W' = W*s; b' = (b-mean)*s + beta. Then foldedconv(in)
== BN(conv(in)) identically. Composes nx_f32_mul/add/sub/sqrt/div. This is the standard "BN-fold" every inference
runtime does; it means the porter never needs a live BatchNorm op. license_tier: ORIGINAL
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_f32.nxnx_f32_div.nx
imported by: nx_f32_bn_fold_gate.nx
structs
| none |
consts
| none |
functions
| 13 | func nx_f32_bn_fold(W: *i64, b: *i64, C_out: i64, wpc: i64, gamma: *i64, beta: *i64, mean: *i64, vari: *i64, eps: i64, W_out: *i64, b_out: *i64) -> i64 |