参考:https://www.shuzhiduo.com/A/1O5EZv6Wd7/ 参考:https 文章目录 2 损失函数 2.7 MarginRankingLoss 边距排序损失 2.8 HingeLoss 与 HingeEmbeddingLoss 铰链嵌入损失 HingeLoss 铰链损失 : HingeEmbeddingLoss 铰链嵌入损失 2.9 多标签分类损失 MultiLabelMarginLoss 2.10 MultiLabelSoftMarginLoss(SoftMarginLoss) 2.11 平滑版L1损失 SmoothL1Loss 2 损失函数 2.7 MarginRankingLoss 边距排序损失 torch.nn.MarginRankingLoss(margin=0.0, reduction='mean') 对于 mini-batch(小批量) 中每个实例的损失函数如下: Ranking:如果排序的内容仅仅是两个元素而已,那么对于某一个元素,只有两个结果,那就是在第二个元素之前或者在第二个元素之前。其实这就是该损失函数的核心了。 y 只能有两个取值,也就是1或者-1。 当y=1 的时候,表示我们预期