From 136b3051f246027807cb0168aa8b6f8d7d2fa08c Mon Sep 17 00:00:00 2001 From: co63oc Date: Tue, 5 Sep 2023 08:28:30 +0800 Subject: [PATCH] Add api_difference --- .../api/paddle/nn/functional/dropout2d_cn.rst | 2 +- .../torch.nn.functional.dropout2d.md | 24 +++++++++++++++++++ .../torch.nn.functional.dropout3d.md | 23 ++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout2d.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout3d.md diff --git a/docs/api/paddle/nn/functional/dropout2d_cn.rst b/docs/api/paddle/nn/functional/dropout2d_cn.rst index fbb157c3dbd..2f88ee153bf 100644 --- a/docs/api/paddle/nn/functional/dropout2d_cn.rst +++ b/docs/api/paddle/nn/functional/dropout2d_cn.rst @@ -3,7 +3,7 @@ dropout2d ------------------------------- -.. py:function:: paddle.nn.functional.dropout2d(x, p=0.5, training=True, name=None) +.. py:function:: paddle.nn.functional.dropout2d(x, p=0.5, training=True, data_format='NCHW', name=None) 根据丢弃概率 `p`,在训练过程中随机将某些通道特征图置 0 (对一个形状为 `NCHW` 的 4 维 Tensor,通道特征图指的是其中的形状为 `HW` 的 2 维特征图)。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout2d.md new file mode 100644 index 00000000000..987e60c616d --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout2d.md @@ -0,0 +1,24 @@ +## [ torch 参数更多 ]torch.nn.functional.dropout2d + +### [torch.nn.functional.dropout2d](https://pytorch.org/docs/stable/generated/torch.nn.functional.dropout2d.html#torch.nn.functional.dropout2d) + +```python +torch.nn.functional.dropout2d(input, p=0.5, training=True, inplace=False) +``` + +### [paddle.nn.functional.dropout2d](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/dropout2d_cn.html) + +```python +paddle.nn.functional.dropout2d(x, p=0.5, training=True, data_format='NCHW', name=None) +``` + +PyTorch 对于 dropout1d/dropout2d/dropout3d,是将某个 Channel 以一定概率全部置 0,Paddle 是所有元素以一定概率置 0,但该差异一般不影响网络训练效果。 +其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下: +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +| -------- | ------------ | --------------------------------------------------------------------------------------------------------------- | +| input | x | 输入的多维 Tensor,仅参数名不一致。 | +| p | p | 将输入节点置 0 的概率,即丢弃概率。 | +| training | training | 标记是否为训练阶段。 | +| inplace | - | 表示在不更改变量的内存地址的情况下,直接修改变量的值,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | +| - | data_format | 指定输入的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout3d.md new file mode 100644 index 00000000000..260e3c4dfd3 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.dropout3d.md @@ -0,0 +1,23 @@ +## [ torch 参数更多 ]torch.nn.functional.dropout3d + +### [torch.nn.functional.dropout3d](https://pytorch.org/docs/stable/generated/torch.nn.functional.dropout3d.html#torch.nn.functional.dropout3d) + +```python +torch.nn.functional.dropout3d(input, p=0.5, training=True, inplace=False) +``` + +### [paddle.nn.functional.dropout3d](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/dropout3d_cn.html) + +```python +paddle.nn.functional.dropout3d(x, p=0.5, training=True, name=None) +``` + +PyTorch 对于 dropout1d/dropout2d/dropout3d,是将某个 Channel 以一定概率全部置 0,Paddle 是所有元素以一定概率置 0,但该差异一般不影响网络训练效果。 +其中 PyTorch 相比 Paddle 支持更多其他参数,具体如下: +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +| -------- | ------------ | --------------------------------------------------------------------------------------------------------------- | +| input | x | 输入的多维 Tensor,仅参数名不一致。 | +| p | p | 将输入节点置 0 的概率,即丢弃概率。 | +| training | training | 标记是否为训练阶段。 | +| inplace | - | 表示在不更改变量的内存地址的情况下,直接修改变量的值,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |