/** * splat-train-backward.parity.ts * * JavaScript port of the WGSL kernel in `splat-train-backward.wgsl`. Exists so the GPU trainer * backward can be exercised in Node (no WebGPU adapter there) and compared against the * gradient-checked CPU reference GaussianTrainer2D.backward2D. * * It mirrors the kernel EXACTLY, including the fixed-point round-trip: gradients are quantized via * `toFixed(v) = round(v * SCALE)` (matching `i32(round(...))` in WGSL), accumulated as integers * (the atomic scatter), then dequantized by `/ SCALE`. The only twin↔WGSL difference is * round-half tie-breaking (JS half-up vs WGSL half-to-even), which is measure-zero on real data. * * Parity chain (mirrors splat-shared-sort): WGSL ↔ this twin is STRUCTURAL (the test regexes the * .wgsl for the load-bearing ops); this twin ↔ backward2D is BEHAVIORAL (numeric, within the * fixed-point tolerance). backward2D ↔ true gradients is already proven by finite differences. * * If splat-train-backward.wgsl is edited, this twin MUST be updated in lockstep. * * @see splat-train-backward.wgsl * @see ../GaussianTrainer2D.ts (backward2D — the CPU reference) */ import type { Gaussian2D, Gaussian2DGrad } from '../GaussianTrainer2D'; /** Fixed-point scale — MUST equal FIXED_POINT_SCALE in splat-train-backward.wgsl. */ export declare const FIXED_POINT_SCALE = 65536; /** Per-pixel hit cap — MUST equal MAX_HITS in the .wgsl. */ export declare const MAX_HITS = 256; /** * Parity twin of the WGSL alpha-blend backward. Returns dequantized per-gaussian gradients * (same shape as backward2D). Uses the production cutoffs (clip=true): sigma<0 skip, * alpha<1/255 skip, 0.999 clamp — matching the kernel. */ export declare function trainBackwardParity(g: Gaussian2D, W: number, H: number, dLimg: Float64Array | Float32Array, bg?: readonly [number, number, number], scale?: number): Gaussian2DGrad; //# sourceMappingURL=splat-train-backward.parity.d.ts.map