loss(x, y) = sum_ij(max(0, 1 - (x[y[j]] - x[i]))) / x.size(0)
Here is the definieition given by Pytorch for its multilabel margin loss 231, "where i == 0 to x.size(0), j == 0 to y.size(0), y[j] != 0, and i != y[j] for all i and j."
It doesn’t make sense to me at all since hinge loss should be something like L(y) = Sum_ij max(0, 1-x[j]*y[j]). Could anyone clarify this?
Also I would really appreciate if anyone could find the source code of this loss function.
Thanks!