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

Hackathon No.21 #4723

Merged
merged 11 commits into from
Jul 27, 2022
Merged

Hackathon No.21 #4723

merged 11 commits into from
Jul 27, 2022

Conversation

yangguohao
Copy link
Contributor

SoftMarginLoss API 中文文档

PADDLEPADDLE_PR=42364

【Hackathon No.21】

@paddle-bot-old
Copy link

paddle-bot-old bot commented May 5, 2022

Thanks for your contribution!

@@ -0,0 +1,36 @@
.. _cn_api_paddle_nn_functional_soft_margin_losss:
Copy link
Collaborator

Choose a reason for hiding this comment

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

多了个 s

soft_margin_loss
-------------------------------

.. py:function:: paddle.nn.functional.soft_margin_loss(input, label, weight:Optional=None, reduction: str = 'mean')
Copy link
Collaborator

Choose a reason for hiding this comment

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

没有 weight 参数吧

:::::::::
- **input** (Tensor) - :math:`[N, *]` ,其中N是batch_size, `*` 是任意其他维度。数据类型是float32、float64。
- **label** (Tensor) - :math:`[N, *]` ,标签 ``label`` 的维度、数据类型与输入 ``input`` 相同。
- **weight** (Tensor,可选) - 手动指定每个batch二值交叉熵的权重,如果指定的话,维度必须是一个batch的数据的维度。数据类型是float32, float64。默认值是:None。
Copy link
Collaborator

Choose a reason for hiding this comment

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

\text{loss}(x, y) = \sum_i \frac{\log(1 + \exp(-y[i]*x[i]))}{\text{x.nelement}()}


最后,添加 `reduce` 操作到前面的输出Out上。当 `reduction` 为 `none` 时,直接返回最原始的 `Out` 结果。当 `reduction` 为 `mean` 时,返回输出的均值 :math:`Out = MEAN(Out)` 。当 `reduction` 为 `sum` 时,返回输出的求和 :math:`Out = SUM(Out)` 。
Copy link
Collaborator

Choose a reason for hiding this comment

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

这一段英文没有,建议补充一下

@Ligoml Ligoml merged commit 78a4acf into PaddlePaddle:develop Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants