Err, not sure I communicated what I meant to here... what I mean is, I usually see the L2 hinge loss formulated as `(lambda/2) ||w||^2 + sum_i xi_i^2`, but you seem to have implemented `(lambda/2) ||w||^2 + (1/2) sum_i xi_i^2`, (where the regularization is implicit in the weight decay, and sometimes `C` is used in place of `lambda`, and sometimes the 1/2 is omitted on the first term, although I don't like that), so (unless you are following a convention I'm not aware of), I would drop the multiplication by `Dtype(0.5)`, (and add a factor of 2 to the gradient).