The Newton undistortion loop selects a zero step when its Jacobian determinant is too small, but computes a division by the original determinant in the unused branch of `torch.where`. Forward output is finite while coordinate and calibration gradients become NaN at a singular Jacobian.