Hey @varunagrawal — I’ve got an approximation to the WARP loss implemented in my package. The loss definition itself is here 160; you can see it in use here 124.
In implementing it, I’ve made some concessions to the minibatch nature of PyTorch operation. Instead of sampling negatives and taking the first one that violates the ranking, I sample a fixed number of negatives at every step and take the maximum of the loss value for every observation in the minibatch. I have omitted adding the approximate rank weighting, but I’m sure you could add it by, say, taking the count of rank-violating negatives for every observation; the key to the rank term is that it approximates how hard it is for the model to get the ranking wrong for any observation.