The multiclass SVM (Weston–Watkins) loss for scores and true class is
Implement hinge_loss(scores, y, delta=1.0) returning the mean over the batch, and hinge_grad(scores, y, delta=1.0) returning (same shape as scores, already divided by the batch size). Use subgradient 0 where a margin is exactly 0.