From a4dec0674c4ce2fb42dedbe8fd2cf7bec021839b Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Wed, 24 Jun 2020 07:16:40 -0700 Subject: [PATCH] [doc] fix typo in formula of MarginRankingLoss (#40285) Summary: This is just a minor doc fix: the `MarginRankingLoss` takes 2 input samples `x1` and `x2`, not just `x` Pull Request resolved: https://github.com/pytorch/pytorch/pull/40285 Reviewed By: ezyang Differential Revision: D22195069 Pulled By: zou3519 fbshipit-source-id: 909f491c94dca329a37216524f4088e9096e0bc6 --- torch/nn/modules/loss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torch/nn/modules/loss.py b/torch/nn/modules/loss.py index bda27f7a6dc..758a77c17ea 100644 --- a/torch/nn/modules/loss.py +++ b/torch/nn/modules/loss.py @@ -1050,10 +1050,10 @@ class MarginRankingLoss(_Loss): If :math:`y = 1` then it assumed the first input should be ranked higher (have a larger value) than the second input, and vice-versa for :math:`y = -1`. - The loss function for each sample in the mini-batch is: + The loss function for each pair of samples in the mini-batch is: .. math:: - \text{loss}(x, y) = \max(0, -y * (x1 - x2) + \text{margin}) + \text{loss}(x1, x2, y) = \max(0, -y * (x1 - x2) + \text{margin}) Args: margin (float, optional): Has a default value of :math:`0`.