Expand description
Fused CIoU loss Triton kernels for YOLO detection training.
Computes Complete-IoU (CIoU) loss between predicted and target boxes, both in XYWH world-coordinate format, in a single fused kernel pass.
CIoU = 1 − IoU + d²/c² + α·v
where:
- IoU = intersection / union
- d² = squared Euclidean distance between box centers
- c² = squared diagonal of the smallest enclosing box
- v = (4/π²) · (atan(tw/th) − atan(pw/ph))² (aspect-ratio consistency)
- α = v / (1 − IoU + v + ε)
Layout:
pred:[4, N]— predicted (cx, cy, w, h) per anchortarget:[4, N]— target (cx, cy, w, h) per anchorloss:[N]— per-anchor CIoU lossiou:[N]— saved IoU (forward → backward)v:[N]— saved aspect-ratio term (forward → backward)alpha:[N]— saved α coefficient (forward → backward)
Parallelism: one CTA per BLOCK_N-wide anchor tile.
Grid: cdiv(N, BLOCK_N) flat CTAs.
Structs§
- Yolo
Ciou Loss Backward - Fused CIoU loss backward: computes ∂L/∂pred given the upstream gradient and the saved activations from the forward pass.
- Yolo
Ciou Loss Forward - Fused CIoU loss forward: predicted and target XYWH boxes → per-anchor loss plus saved activations (iou, v, alpha) needed by the backward pass.
Functions§
- yolo_
ciou_ loss_ backward - Fused CIoU loss backward: computes ∂L/∂pred given the upstream gradient and the saved activations from the forward pass.
- yolo_
ciou_ loss_ forward - Fused CIoU loss forward: predicted and target XYWH boxes → per-anchor loss plus saved activations (iou, v, alpha) needed by the backward pass.