Move formulas on separate line in loss.py (#150565)

Move formulas on separate line in loss.py for better readability.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/150565
Approved by: https://github.com/mikaylagawarecki
This commit is contained in:
Svetlana Karslioglu 2025-04-03 20:47:35 +00:00 committed by PyTorch MergeBot
parent a3f9e04656
commit 277369ac16

View File

@ -154,8 +154,8 @@ class NLLLoss(_WeightedLoss):
The unreduced (i.e. with :attr:`reduction` set to ``'none'``) loss can be described as:
.. math::
\ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \quad
l_n = - w_{y_n} x_{n,y_n}, \quad
\ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \\
l_n = - w_{y_n} x_{n,y_n}, \\
w_{c} = \text{weight}[c] \cdot \mathbb{1}\{c \not= \text{ignore\_index}\},
where :math:`x` is the input, :math:`y` is the target, :math:`w` is the weight, and