nx_f32_upsample_bilinear.nx
buildroot/runtime/nx_f32_upsample_bilinear.nx
about
nx_f32_upsample_bilinear.nx -- software-f32 BILINEAR upsample (NCHW, integer scale, align_corners=FALSE to match
PyTorch/HF nn.functional.interpolate). The LAST vision op the pose port needed: ViTPose's SIMPLE decoder is
ReLU -> bilinear-upsample(scale_factor) -> Conv2d, so a FAITHFUL port (bit-comparable to the reference) needs true
bilinear, not nearest. Trick: with an INTEGER scale the sample coordinate src=(dst+0.5)/scale-0.5 is rational with
denominator 2*scale, so ALL coordinate + weight math is exact INTEGER (floor, neighbor indices, the 4 bilinear
weights that sum to (2*scale)^2); only the pixel combine + final /den^2 use f32. No f32 floor needed. Border:
out-of-range neighbor indices clamp to [0,H-1]/[0,W-1] (PyTorch edge behavior). license_tier: ORIGINAL
dependencies 4 imports · 2 importers
imports: nx_syscalls.nxnx_f32.nxnx_f32_cvt.nxnx_f32_div.nx
imported by: nx_f32_upsample_bilinear_gate.nxnx_vitpose_forward.nx
structs
| none |
consts
| 13 | const NX_UB_OK: i64 = 0 |
| 14 | const NX_UB_ERR_ARGS: i64 = 4 |
functions
| 16 | func nx_f32_upsample_bilinear(input: *i64, N: i64, C: i64, H: i64, W: i64, scale: i64, out: *i64) -> i64 |