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 易用性提升 #7028

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/api/paddle/nn/MultiLabelSoftMarginLoss_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ MultiLabelSoftMarginLoss
损失函数按照下列公式计算

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

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.

是的


其中 :math:`\text{C}` 为类别数量,
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个后面是一个逗号吗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改为句号,这一句是对上面公式的说明


如果添加权重则再乘以对应的权重值
Copy link
Collaborator

Choose a reason for hiding this comment

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

这两句话 感觉也不太通顺


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ multi_label_soft_margin_loss
损失函数按照下列公式计算

.. math::
\text{loss}(x, y) = \sum_{ij}\frac{\max(0, 1 - (x[y[j]] - x[i]))}{\text{x.shape}(0)}
\text{loss}(input, label) = - \frac{1}{\text{C}} * \sum_i label[i] * \log((1 + \exp(-input[i]))^{-1}) + (1-label[i]) * \log\left(\frac{\exp(-input[i])}{(1 + \exp(-input[i]))}\right)

其中 :math:`\text{C}` 为类别数量,
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改为句号,这一句是对上面公式的说明


如果添加权重则再乘以对应的权重值

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@
| NOT-IMPLEMENTED-ITEM(`torch.xpu.current_device`, https://pytorch.org/docs/stable/generated/torch.xpu.current_device.html#torch-xpu-current-device, 有对应相近功能但设计差异大无法映射,一般无需新增) |
| NOT-IMPLEMENTED-ITEM(`torch.xpu.get_device_properties`, https://pytorch.org/docs/stable/generated/torch.xpu.get_device_properties.html#torch-xpu-get-device-properties, 有对应相近功能但设计差异大无法映射,一般无需新增) |
| NOT-IMPLEMENTED-ITEM(`torch.nn.functional.multilabel_margin_loss`, https://pytorch.org/docs/stable/generated/torch.nn.functional.multilabel_margin_loss.html#torch-nn-functional-multilabel-margin-loss, 可新增,且框架底层有相关设计,成本低) |
| NOT-IMPLEMENTED-ITEM(`torch.nn.functional.MultiLabelMarginLoss`, https://pytorch.org/docs/stable/generated/torch.nn.MultiLabelMarginLoss.html#torch.nn.MultiLabelMarginLoss, 可新增,且框架底层有相关设计,成本低) |
| NOT-IMPLEMENTED-ITEM(`torch.gradient`, https://pytorch.org/docs/stable/generated/torch.gradient.html#torch-gradient, 可新增,且框架底层有相关设计,成本低) |
| NOT-IMPLEMENTED-ITEM(`torch.Tensor.sparse_resize_`, https://pytorch.org/docs/stable/generated/torch.Tensor.sparse_resize_.html#torch-tensor-sparse-resize, 可新增,且框架底层有相关设计,成本低) |
| NOT-IMPLEMENTED-ITEM(`torch.autograd.profiler.profile`, https://pytorch.org/docs/stable/autograd.html#torch.autograd.profiler.profile, 可新增,但框架底层无相关设计,成本高) |
Expand Down