Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update F.multi_label_soft_margin_loss/nn.MultiLabelSoftMarginLoss docs 易用性提升 #70389

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Dec 21, 2024

PR Category

User Experience

PR Types

Improvements

Description

原文档公式是MultiLabelMarginLoss的公式 (参考 https://pytorch.org/docs/stable/generated/torch.nn.MultiLabelMarginLoss.html)
改为MultiLabelSoftMarginLoss对应公式 (参考https://pytorch.org/docs/stable/generated/torch.nn.MultiLabelSoftMarginLoss.html)

Copy link

paddle-bot bot commented Dec 21, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@@ -3449,13 +3449,11 @@ def multi_label_soft_margin_loss(
For each sample in the mini-batch:

.. math::
\text{loss}(x, y) = \sum_{ij}\frac{\max(0, 1 - (x[y[j]] - x[i]))}{\text{x.size}(0)}
\text{loss}(x, y) = - \frac{1}{C} * \sum_i y[i] * \log((1 + \exp(-x[i]))^{-1})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是文档写成了MultiLabelMarginLoss,但是实现是MultiLabelSoftMarginLoss 对吧?MultiLabelSoftMarginLoss 没有问题吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,实现是MultiLabelSoftMarginLoss的实现

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1 luotao1 merged commit 47e45cf into PaddlePaddle:develop Dec 25, 2024
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants