pub fn yolo_bce_cls_loss_backward<T: Triton, D: Float, const BLOCK_N: i32>(
dy_ptr: T::Pointer<D>,
pred_ptr: T::Pointer<D>,
target_ptr: T::Pointer<D>,
d_pred_ptr: T::Pointer<D>,
N: i32,
C: i32,
)Expand description
BCE classification loss backward: upstream gradient + forward inputs → ∂L/∂pred.
Per element: d_pred[c,n] = dy[n] · (sigmoid(pred[c,n]) − target[c,n])
Uses the numerically stable sigmoid: σ(x) = 1 / (1 + exp(−x)).
No saved activations are needed because the gradient depends only on the
forward inputs (pred logits and targets).
Grid: cdiv(N, BLOCK_N) — one CTA per anchor tile.