Skip to content

Commit 6c5faea

Browse files
committed
[API Compatibility No.155] Update docs for bce_with_logits alias support
1 parent 8cc4a92 commit 6c5faea

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

docs/api/paddle/nn/functional/binary_cross_entropy_with_logits_cn.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ binary_cross_entropy_with_logits
3434
3535
参数
3636
:::::::::
37-
- **logit** (Tensor) - :math:`[N, *]`,其中 N 是 batch_size, `*` 是任意其他维度。输入数据 ``logit`` 一般是线性层的输出,不需要经过 ``sigmoid`` 层。数据类型是 float32、float64。
38-
- **label** (Tensor) - :math:`[N, *]`,标签 ``label`` 的维度、数据类型与输入 ``logit`` 相同。
37+
- **logit** (Tensor) - :math:`[N, *]`,其中 N 是 batch_size, `*` 是任意其他维度。输入数据 ``logit`` 一般是线性层的输出,不需要经过 ``sigmoid`` 层。数据类型是 float32、float64。别名:``input``。
38+
- **label** (Tensor) - :math:`[N, *]`,标签 ``label`` 的维度、数据类型与输入 ``logit`` 相同。别名:``target``。
3939
- **weight** (Tensor,可选) - 手动指定每个 batch 二值交叉熵的权重,如果指定的话,维度必须是一个 batch 的数据的维度。数据类型是 float32, float64。默认值是:None。
4040
- **reduction** (str,可选) - 指定应用于输出结果的计算方式,可选值有:``'none'``, ``'mean'``, ``'sum'``。默认为 ``'mean'``,计算 `BCELoss` 的均值;设置为 ``'sum'`` 时,计算 `BCELoss` 的总和;设置为 ``'none'`` 时,则返回原始 loss。
4141
- **pos_weight** (Tensor,可选) - 手动指定正类的权重,必须是与类别数相等长度的向量。数据类型是 float32, float64。默认值是:None。

docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy_with_logits.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ torch.nn.functional.binary_cross_entropy_with_logits(input, target, weight=None,
99
paddle.nn.functional.binary_cross_entropy_with_logits(logit, label, weight=None, reduction='mean', pos_weight=None, name=None)
1010
```
1111

12+
其中 `input` 是 Paddle 参数 `logit` 的别名,`target` 是 Paddle 参数 `label` 的别名。
13+
1214
PyTorch 相比 Paddle 支持更多其他参数,具体如下:
1315

1416
### 参数映射
1517

1618
| PyTorch | PaddlePaddle | 备注 |
1719
| ------------- | ------------ | ------------------------------------------------------ |
18-
| input | logit | 表示输入的 Tensor。 |
19-
| target | label | 标签,和 input 具有相同的维度,仅参数名不一致|
20+
| input | logit | 表示输入的 Tensor。Paddle 兼容 `input` 别名,无需改写。 |
21+
| target | label | 标签,和 input 具有相同的维度。Paddle 兼容 `target` 别名,无需改写|
2022
| weight | weight | 类别权重。 |
2123
| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 Paddle 无此参数,需要转写。 |
2224
| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 Paddle 无此参数,需要转写。 |

0 commit comments

Comments
 (0)