1 hinge loss
loss=output-output_neg+self.margin#contains i=y
loss[loss<0]=0
其中,y是正样本的得分,y'是负样本的得分,m是margin
https://www.cnblogs.com/lainey/p/8583101.html
2 pairwise loss
loss = torch.log(1+torch.exp(-(pos_score-retrieve_score)))
https://github.com/Wangld5/BERT_pairwise_ranking/blob/master/model.py