From 3866013460fa9c51e053605c21e1f1ffbf70e505 Mon Sep 17 00:00:00 2001 From: zhwesky2010 Date: Tue, 27 Jun 2023 10:41:29 +0000 Subject: [PATCH] fix api difference doc --- .../Tensor/torch.Tensor.maximum.md | 9 ++- .../Tensor/torch.Tensor.mean.md | 4 +- .../Tensor/torch.Tensor.median.md | 20 ------ .../api_difference/Tensor/torch.Tensor.min.md | 20 ------ .../Tensor/torch.Tensor.minimum.md | 8 +-- .../api_difference/Tensor/torch.Tensor.mm.md | 6 +- .../Tensor/torch.Tensor.mode.md | 18 ----- .../Tensor/torch.Tensor.moveaxis.md | 8 +-- .../Tensor/torch.Tensor.movedim.md | 8 +-- .../Tensor/torch.Tensor.nanmedian.md | 18 ----- .../Tensor/torch.Tensor.permute.md | 10 +-- .../Tensor/torch.Tensor.repeat.md | 10 +-- .../Tensor/torch.Tensor.reshape.md | 10 +-- .../Tensor/torch.Tensor.scatter_.md | 29 -------- .../Tensor/torch.Tensor.scatter_add.md | 2 +- .../Tensor/torch.Tensor.scatter_add_.md | 4 +- .../Tensor/torch.Tensor.split.md | 6 +- .../Tensor/torch.Tensor.transpose.md | 4 +- .../api_difference/cuda/torch.cuda.device.md | 28 -------- .../cuda/torch.cuda.get_device_name.md | 5 +- .../api_difference/fft/torch.fft.fftfreq.md | 8 +-- .../api_difference/fft/torch.fft.hfft.md | 6 +- .../api_difference/fft/torch.fft.ihfft.md | 4 +- .../api_difference/fft/torch.fft.irfftn.md | 5 +- .../api_difference/fft/torch.fft.rfftfreq.md | 8 +-- .../hub/torch.hub.download_url_to_file.md | 6 +- .../api_difference/hub/torch.hub.help.md | 13 ++-- .../api_difference/hub/torch.hub.list.md | 14 ++-- .../api_difference/hub/torch.hub.load.md | 19 ++--- .../api_difference/jit/torch.jit.save.md | 46 ------------ .../nn/torch.nn.Module.add_module.md | 6 +- .../nn/torch.nn.Module.apply.md | 4 +- .../api_difference/nn/torch.nn.ModuleDict.md | 4 +- .../api_difference/nn/torch.nn.ModuleList.md | 6 +- .../nn/torch.nn.functional.softmax.md | 33 +-------- .../api_difference/ops/torch.bernoulli.md | 6 +- .../api_difference/ops/torch.multinomial.md | 6 +- .../api_difference/ops/torch.nonzero.md | 70 +++++++++---------- .../api_difference/ops/torch.normal.md | 2 +- .../torch.optim.Optimizer.load_state_dict.md | 6 +- .../ops/torch.optim.Optimizer.state_dict.md | 2 +- .../api_difference/ops/torch.poisson.md | 2 +- .../api_difference/ops/torch.scatter_add.md | 2 +- .../ops/torch.set_printoptions.md | 2 +- .../ops/torch.sparse_coo_tensor.md | 8 +-- .../api_difference/ops/torch.stack.md | 2 +- 46 files changed, 156 insertions(+), 361 deletions(-) delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.median.md delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.min.md delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mode.md delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nanmedian.md delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_.md delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.device.md delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/jit/torch.jit.save.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.maximum.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.maximum.md index 78b82f8fde4..368cf7c0f87 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.maximum.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.maximum.md @@ -1,4 +1,4 @@ -## [仅paddle参数更多]torch.Tensor.maximum +## [ 仅参数名不同 ] torch.Tensor.maximum ### [torch.Tensor.maximum](https://pytorch.org/docs/stable/generated/torch.Tensor.maximum.html#torch.Tensor.maximum) @@ -9,12 +9,11 @@ torch.Tensor.maximum(other) ### [paddle.Tensor.maximum](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#maximum-y-axis-1-name-none) ```python -paddle.Tensor.maximum(y, axis=-1, name=None) +paddle.Tensor.maximum(y) ``` -其中 Paddle 相比 Pytorch 支持更多其他参数,具体如下: +两者功能一致且参数用法一致,仅参数名不同,具体如下: | PyTorch | PaddlePaddle | 备注 | |----------------------------------|---------------------------------|------------------------------------| -| other | y | 输⼊ Tensor ,仅名称不同。 | -| - | axis | 指定进行运算的轴,Pytorch无此参数,Paddle保持默认即可。 | \ No newline at end of file +| other | y | 输⼊第二个 Tensor ,仅参数名不同。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mean.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mean.md index 30789bfff23..9f55cd5aca8 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mean.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mean.md @@ -1,4 +1,4 @@ -## [torch 参数更多]torch.Tensor.mean +## [ torch 参数更多 ]torch.Tensor.mean ### [torch.Tensor.mean](https://pytorch.org/docs/stable/generated/torch.Tensor.mean.html#torch.Tensor.mean) @@ -17,4 +17,4 @@ paddle.Tensor.mean(axis=None, keepdim=False, name=None) |-----------------------|------------------------------------|----------------------------------------| | dim | axis | 指定进行运算的轴,仅参数名不同。 | | keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度。 | -| dtpye | - | 表示输出Tensor的数据类型,一般对训练影响不大,可直接删去 | +| dtpye | - | 表示输出 Tensor 的数据类型,一般对训练影响不大,可直接删去 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.median.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.median.md deleted file mode 100644 index b8e41a0e2f9..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.median.md +++ /dev/null @@ -1,20 +0,0 @@ -## [仅参数名不一致]torch.Tensor.median - -### [torch.Tensor.median](https://pytorch.org/docs/stable/generated/torch.Tensor.median.html) - -```python -torch.Tensor.median(dim=None, keepdim=False) -``` - -### [paddle.Tensor.median](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#median-axis-none-keepdim-false-name-none) - -```python -paddle.Tensor.median(axis=None, keepdim=False, name=None) -``` - -两者功能一致且参数用法一致,仅参数名不同,具体如下: - -| PyTorch | PaddlePaddle | 备注 | -|------------------------------------|------------------------------------|----------------------------------------| -| dim | axis | 指定进行运算的轴,仅参数名不同。 | -| keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度。 | \ No newline at end of file diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.min.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.min.md deleted file mode 100644 index 3cc09ed8d8d..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.min.md +++ /dev/null @@ -1,20 +0,0 @@ -## [仅参数名不一致]torch.Tensor.min - -### [torch.Tensor.min](https://pytorch.org/docs/stable/generated/torch.Tensor.min.html) - -```python -torch.Tensor.min(dim=None, keepdim=False) -``` - -### [paddle.Tensor.min](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#min-axis-none-keepdim-false-name-none) - -```python -paddle.Tensor.min(axis=None, keepdim=False, name=None) -``` - -两者功能一致且参数用法一致,仅参数名不同,具体如下: - -| PyTorch | PaddlePaddle | 备注 | -|------------------------------------|------------------------------------|----------------------------------------| -| dim | axis | 指定进行运算的轴,仅参数名不同。 | -| keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度。 | \ No newline at end of file diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.minimum.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.minimum.md index 337d738369a..2179d78e83e 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.minimum.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.minimum.md @@ -1,4 +1,4 @@ -## [paddle 参数更多]torch.Tensor.minimum +## [ paddle 参数更多 ]torch.Tensor.minimum ### [torch.Tnsor.,minimum](https://pytorch.org/docs/stable/generated/torch.Tensor.minimum.html) @@ -9,12 +9,12 @@ torch.Tensor.maximum(other) ### [paddle.Tensor.minimum](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#minimum-y-axis-1-name-none) ```python -paddle.Tensor.minimum(y, axis=-1, name=None) +paddle.Tensor.minimum(y) ``` -其中 Paddle 相比 Pytorch 支持更多其他参数,具体如下: +两者功能一致且参数用法一致,仅参数名不同,具体如下: | PyTorch | PaddlePaddle | 备注 | |----------------------------------|---------------------------------|------------------------------------| | other | y | 输⼊ Tensor ,仅名称不同。 | -| - | axis | 指定进行运算的轴,Pytorch无此参数,Paddle保持默认即可。 | \ No newline at end of file +| - | axis | 指定进行运算的轴,Pytorch 无此参数,Paddle 保持默认即可。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mm.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mm.md index 69793f2035b..465c42a0f7d 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mm.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mm.md @@ -1,4 +1,4 @@ -## [仅参数名完全一致]torch.Tensor.mm +## [ 参数完全一致 ]torch.Tensor.mm ### [torch.Tensor.mm](https://pytorch.org/docs/stable/generated/torch.Tensor.mm.html) @@ -9,7 +9,7 @@ torch.Tensor.mm(mat2) ### [paddle.Tensor.mm](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#mm-mat2-name-none) ```python -paddle.Tensor.mm(mat2,name=None) +paddle.Tensor.mm(mat2, name=None) ``` 两者功能一致且参数用法一致,具体如下: @@ -18,4 +18,4 @@ paddle.Tensor.mm(mat2,name=None) | PyTorch | PaddlePaddle | 备注 | |---------------------------------|---------------------------------| ----------------------------------------- | -| mat2 | mat2 | 输⼊ Tensor 。 | \ No newline at end of file +| mat2 | mat2 | 输⼊ Tensor 。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mode.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mode.md deleted file mode 100644 index 93126066902..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.mode.md +++ /dev/null @@ -1,18 +0,0 @@ -## [仅参数名称不一致]torch.Tensor.mode - -### [torch.Tensor.mode](https://pytorch.org/docs/stable/generated/torch.Tensor.mode.html) - -```python -torch.Tensor.nanmean(dim=None, keepdim=False) -``` - -### [paddle.Tensor.mode](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#mode-axis-1-keepdim-false-name-none) -```python -paddle.Tensor.nanmedian(axis=None, keepdim=True, name=None) -``` -两者功能一致且参数用法一致,仅参数名不同,具体如下: - -| PyTorch | PaddlePaddle | 备注 | -|------------------------------------|------------------------------------|----------------------------------------| -| dim | axis | 指定进行运算的轴,仅参数名不同。 | -| keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度。 | \ No newline at end of file diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.moveaxis.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.moveaxis.md index 68ee937400f..467823b48a4 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.moveaxis.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.moveaxis.md @@ -1,15 +1,15 @@ -## [参数完全一致]torch.Tensor.moveaxis +## [ 参数完全一致 ]torch.Tensor.moveaxis ### [torch.Tensor.moveaxis](https://pytorch.org/docs/stable/generated/torch.Tensor.moveaxis.html) ```python -torch.Tensor.moveaxis(source, destination) +torch.Tensor.moveaxis(source, destination) ``` ### [paddle.Tensor.moveaxis](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/moveaxis_cn.html) ```python -paddle.Tensor.moveaxis(source, destination,name = None) +paddle.Tensor.moveaxis(source, destination,name = None) ``` 两者功能一致且参数用法一致,具体如下: @@ -17,4 +17,4 @@ paddle.Tensor.moveaxis(source, destination,name = None) | PyTorch | PaddlePaddle | 备注 | |------------------------------------|------------------------------------|----------------------------------| | source | source | 将被移动的轴的位置。 | -| destination | destination | 轴被移动后的目标位置。 | \ No newline at end of file +| destination | destination | 轴被移动后的目标位置。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.movedim.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.movedim.md index 8661f3712ba..842f24973d1 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.movedim.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.movedim.md @@ -1,15 +1,15 @@ -## [参数完全一致]torch.Tensor.movedim +## [ 参数完全一致 ]torch.Tensor.movedim ### [torch.Tensor.movedim](https://pytorch.org/docs/stable/generated/torch.Tensor.movedim.html) ```python -torch.Tensor.movedim(source, destination) +torch.Tensor.movedim(source, destination) ``` ### [paddle.Tensor.moveaxis](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/moveaxis_cn.html) ```python -paddle.Tensor.moveaxis(source, destination,name = None) +paddle.Tensor.moveaxis(source, destination,name = None) ``` 两者功能一致且参数用法一致,具体如下: @@ -17,4 +17,4 @@ paddle.Tensor.moveaxis(source, destination,name = None) | PyTorch | PaddlePaddle | 备注 | |------------------------------------|------------------------------------|----------------------------------| | source | source | 将被移动的轴的位置。 | -| destination | destination | 轴被移动后的目标位置。 | \ No newline at end of file +| destination | destination | 轴被移动后的目标位置。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nanmedian.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nanmedian.md deleted file mode 100644 index 10913cfd11d..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nanmedian.md +++ /dev/null @@ -1,18 +0,0 @@ -## [仅参数名称不一致]torch.Tensor.nanmedian - -### [torch.Tensor.nanmedian](https://pytorch.org/docs/stable/generated/torch.Tensor.nanmedian.html) - -```python -torch.Tensor.nanmean(dim=None, keepdim=False) -``` - -### [paddle.Tensor.nanmedian](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#nanmedian-axis-none-keepdim-true-name-none) -```python -paddle.Tensor.nanmedian(axis=None, keepdim=True, name=None) -``` -两者功能一致且参数用法一致,仅参数名不同,具体如下: - -| PyTorch | PaddlePaddle | 备注 | -|------------------------------------|------------------------------------|----------------------------------------| -| dim | axis | 指定进行运算的轴,仅参数名不同。 | -| keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度。 | \ No newline at end of file diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.permute.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.permute.md index e32413286d4..d12e3b8582e 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.permute.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.permute.md @@ -1,4 +1,4 @@ -## [参数不一致]torch.Tensor.permute +## [ 参数不一致 ]torch.Tensor.permute ### [torch.Tensor.permute](https://pytorch.org/docs/1.13/generated/torch.Tensor.permute.html) @@ -12,18 +12,18 @@ torch.Tensor.permute(*dims) paddle.Tensor.transpose(perm, name=None) ``` -Pytorch 的 `dims` 与 paddle 的 `perm` 两者部分参数用法不同,具体如下: +Pytorch 的 `*dims` 相比于 paddle 的 `perm` 额外支持可变参数的用法,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| *dims | perm | torch 支持可变参数或 list/tuple,paddle 仅支持 list/tuple,参数用法不一致,需要进行转写。 | +| *dims | perm | torch 支持可变参数或 list/tuple,paddle 仅支持 list/tuple。对于可变参数的用法,需要进行转写。 | ### 转写示例 -#### *dim: Tensor 的维度序列,可变参数用法 +#### *dims: 可变参数用法 ```python # pytorch x = torch.randn(2, 3, 5) -y = x.permute(2,0,1) +y = x.permute(2, 0, 1) # paddle x = paddle.randn([2, 3, 5]) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.repeat.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.repeat.md index 7e14df05a0f..e3361bb892b 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.repeat.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.repeat.md @@ -1,4 +1,4 @@ -## [参数不一致]torch.Tensor.repeat +## [ 参数不一致 ]torch.Tensor.repeat ### [torch.Tensor.repeat](https://pytorch.org/docs/1.13/generated/torch.Tensor.repeat.html) @@ -12,20 +12,20 @@ torch.Tensor.repeat(*sizes) paddle.Tensor.tile(repeat_times, name=None) ``` -Pytorch 的 `sizes` 参数与 Paddle 的 `repeat_times` 参数用法不同,具体如下: +Pytorch 的 `*sizes` 相比于 Paddle 的 `repeat_times` 额外支持可变参数的用法,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| *sizes | repeat_times | torch 支持可变参数或 list/tuple,paddle 仅支持 list/tuple/Tensor,参数用法不一致,需要进行转写。| +| *sizes | repeat_times | torch 支持可变参数或 list/tuple,paddle 仅支持 list/tuple。对于可变参数的用法,需要进行转写。 | ### 转写示例 #### *sizes: 各个维度重复的次数,可变参数用法 ```python # pytorch x = torch.randn(2, 3, 5) -y = x.repeat(4,2,1) +y = x.repeat(4, 2, 1) # paddle x = paddle.randn([2, 3, 5]) -y = x.tile((4,2,1)) +y = x.tile((4, 2, 1)) ``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape.md index e422fd557d5..9fc2db95ba1 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape.md @@ -1,4 +1,4 @@ -## [参数不一致]torch.Tensor.reshape +## [ 参数不一致 ]torch.Tensor.reshape ### [torch.Tensor.reshape](https://pytorch.org/docs/1.13/generated/torch.Tensor.reshape.html) @@ -12,20 +12,20 @@ torch.Tensor.reshape(*shape) paddle.Tensor.reshape(shape, name=None) ``` -Pytorch 的 `*shape` 参数与 Paddle 的 `shape` 参数用法不同,具体如下: +Pytorch 的 `*shape` 相比于 Paddle 的 `shape` 额外支持可变参数的用法,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| *shape | shape | torch 的 *shape 既可以接收 list 也可接收可变参数。需要转写。| +| *shape | shape | torch 支持可变参数或 list/tuple,paddle 仅支持 list/tuple。对于可变参数的用法,需要进行转写。 | ### 转写示例 #### *shape: 新数组的维度序列,可变参数用法 ```python # pytorch x = torch.randn(2, 3, 5) -y = x.reshape(6,5) +y = x.reshape(6, 5) # paddle x = paddle.randn([2, 3, 5]) -y = x.tile((6,5)) +y = x.reshape((6, 5)) ``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_.md deleted file mode 100644 index 0c9010f8d81..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_.md +++ /dev/null @@ -1,29 +0,0 @@ -## [仅参数名不一致]torch.Tensor.scatter_ - -### [torch.Tensor.scatter_](https://pytorch.org/docs/1.13/generated/torch.Tensor.scatter_.html#torch.Tensor.scatter_) - -```python -torch.Tensor.scatter_(dim, - index, - src, - reduce=None) -``` - -### [paddle.Tensor.put_along_axis_](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/put_along_axis__cn.html) - -```python -paddle.Tensor.put_along_axis_(indices, - value, - axis, - reduce) -``` - -两者功能一致且参数用法一致,仅参数名不一致,具体如下: - -### 参数差异 -| PyTorch | PaddlePaddle | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -| dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 | -| index | indices | 表示输入的索引张量,仅参数名不一致。 | -| src | values | 表示需要插入的值,仅参数名不一致。 | -| reduce | reduce | 表示对输出 Tensor 的计算方式。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add.md index 1dcc7889a0c..18e62edc2b1 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add.md @@ -1,4 +1,4 @@ -## [组合替代实现]torch.Tensor.scatter_add +## [ 组合替代实现 ]torch.Tensor.scatter_add ### [torch.Tensor.scatter_add](https://pytorch.org/docs/1.13/generated/torch.Tensor.scatter_add.html#torch.Tensor.scatter_add) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add_.md index 14521f11e06..d18c2919c0f 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add_.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.scatter_add_.md @@ -1,4 +1,4 @@ -## [仅 paddle 参数更多]torch.Tensor.scatter_add_ +## [ 仅 paddle 参数更多 ]torch.Tensor.scatter_add_ ### [torch.Tensor.scatter_add_](https://pytorch.org/docs/1.13/generated/torch.Tensor.scatter_add_.html#torch.Tensor.scatter_add_) @@ -25,4 +25,4 @@ paddle.Tensor.put_along_axis_(indices, | dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 | | index | indices | 表示输入的索引张量,仅参数名不一致。 | | src | values | 表示需要插入的值,仅参数名不一致。 | -| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数, Paddle 应设置为 add 。 | +| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数, Paddle 应设置为 'add' 。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.split.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.split.md index fed0791cff6..c5b038fbf30 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.split.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.split.md @@ -1,4 +1,4 @@ -## [参数不一致]torch.Tensor.split +## [ 参数不一致 ]torch.Tensor.split ### [torch.Tensor.split](https://pytorch.org/docs/1.13/generated/torch.Tensor.split.html) @@ -17,10 +17,10 @@ Pytorch 的 `split_size_or_sections` 与 Paddle 的 `num_or_sections` 用法不 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | | dim | axis | 表示需要分割的维度,仅参数名不同。 | -| split_size_or_sections | num_or_sections | torch 的 split_size_or_sections :int 时表示块的大小, list 时表示块的大小; paddle 的 num_or_sections : int 时表示块的个数, list 时表示块的大小。参数类型为 int 时需要转写。| +| split_size_or_sections | num_or_sections | torch:int 时表示块的大小, list 时表示块的大小; paddle: int 时表示块的个数, list 时表示块的大小。对于 int 时用法不同,需要转写。| ### 转写示例 -#### split_size_or_sections: 参数类型为 int 时表示块的大小 +#### split_size_or_sections: int 时表示块的大小,而 paddle 表示块的个数 ```python # pytorch x = torch.randn(8, 2) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.transpose.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.transpose.md index ef887f5b1ee..f98bf7aafd9 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.transpose.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.transpose.md @@ -1,4 +1,4 @@ -## [参数不一致]torch.Tensor.transpose +## [ 参数不一致 ]torch.Tensor.transpose ### [torch.Tensor.transpose](https://pytorch.org/docs/1.13/generated/torch.Tensor.transpose.html) @@ -23,7 +23,7 @@ Pytorch 的 `dim0, dim1` 与 Paddle 的 `perm` 用法不同,具体如下: ```python # pytorch x = torch.randn(2, 3, 5) -y = x.transpose(0,1) +y = x.transpose(0, 1) # paddle x = paddle.randn([2, 3, 5]) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.device.md deleted file mode 100644 index 093b611af5c..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.device.md +++ /dev/null @@ -1,28 +0,0 @@ -## [参数不一致]torch.cuda.device - -### [torch.cuda.device](https://pytorch.org/docs/1.13/generated/torch.cuda.device.html) - -```python -torch.cuda.device(device) -``` - -### [paddle.CUDAPlace](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/CUDAPlace_cn.html#cudaplace) - -```python -paddle.CUDAPlace(id) -``` - -Pytorch 的 `device` 与 Paddle 的 `id` 用法不同,具体如下: -### 参数映射 -| PyTorch | PaddlePaddle | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -| device | id | torch 的 device 参数类型为 torch.device 或 int 。paddle 的 id 为 int。 torch 参数为 int 时无需转写, 参数为 torch.device 时,需要转写。| - -### 转写示例 -```python -# PyTorch 写法 -torch.cuda.device(torch.device('cuda:0')) - -# Paddle 写法 -paddle.CUDAPlace(0) -``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.get_device_name.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.get_device_name.md index efb34b92c18..70300963047 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.get_device_name.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.get_device_name.md @@ -1,4 +1,4 @@ -## [参数不一致]torch.cuda.get_device_name +## [ 参数不一致 ]torch.cuda.get_device_name ### [torch.cuda.get_device_name](https://pytorch.org/docs/1.13/generated/torch.cuda.get_device_name.html) @@ -17,9 +17,10 @@ paddle.device.cuda.get_device_properties(device) | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | | device | device | torch 的 device 参数类型为 torch.device 或 int 或 str。paddle 的 device 为 paddle.CUDAPlace 或 int 或 str。 | -| Returns | Returns | 两者返回类型不一致。 paddle 的返回数据中 name 属性内容与 torch 的返回内容一致。需要转写。| +| 返回值 | 返回值 | 两者返回类型不一致。torch 返回字符串,paddle 返回包含设备多个属性的数据结构,对其取 name 属性即可。需要转写。| ### 转写示例 +#### 返回值 ```python # pytorch y = torch.cuda.get_device_name() diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftfreq.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftfreq.md index 92e5cd56159..cfd47733459 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftfreq.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftfreq.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.fft.fftfreq +## [ torch 参数更多 ] torch.fft.fftfreq ### [torch.fft.fftfreq](https://pytorch.org/docs/stable/generated/torch.fft.fftfreq.html?highlight=fftfreq#torch.fft.fftfreq) @@ -30,9 +30,9 @@ paddle.fft.fftfreq(n, | d | d | 采样间隔,采样率的倒数,默认值为 1。 | | out | - |输出的 Tensor,Paddle 无此参数,需要进行转写。 | | dtype | dtype |返回 Tensor 的数据类型。 | -|layout |- |表示布局方式,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| -|device |- |表示 Tensor 存放设备位置,Paddle 无此参数,需要进行转写。 | -|requires_grad |- |表示是否不阻断梯度传导,Paddle 无此参数,需要进行转写。 | +| layout |- |表示布局方式,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| device |- |表示 Tensor 存放设备位置,Paddle 无此参数,需要进行转写。 | +| requires_grad |- |表示是否不阻断梯度传导,Paddle 无此参数,需要进行转写。 | ### 转写示例 #### out:指定输出 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft.md index 05e81679f86..44dae9cf35b 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.fft.hfft +## [ torch 参数更多 ] torch.fft.hfft ### [torch.fft.hfft](https://pytorch.org/docs/stable/generated/torch.fft.hfft.html?highlight=hfft#torch.fft.hfft) @@ -28,8 +28,8 @@ paddle.fft.hfft(x, | input | x | 输入 Tensor,仅参数名不一致。 | | n | n | 输出 Tensor 在傅里叶变换轴的长度。 | | dim | axis | 傅里叶变换的轴,如果没有指定,默认是使用最后一维,仅参数名不一致。| -| norm |norm |傅里叶变换的缩放模式,缩放系数由变换的方向和缩放模式同时决定,默认是 backward。| -| out | - |输出的 Tensor,Paddle 无此参数,需要进行转写。 | +| norm |norm |傅里叶变换的缩放模式,缩放系数由变换的方向和缩放模式同时决定,完全一致。| +| out | - |输出 Tensor,Paddle 无此参数,需要进行转写。 | ### 转写示例 #### out:指定输出 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft.md index d6fe0780ed4..5377909b265 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.fft.ihfft +## [ torch 参数更多 ] torch.fft.ihfft ### [torch.fft.ihfft](https://pytorch.org/docs/1.13/generated/torch.fft.ihfft.html?highlight=ihfft#torch.fft.ihfft) @@ -28,7 +28,7 @@ paddle.fft.ihfft(x, | input | x |输入 Tensor,仅参数名不一致。 | | n | n |傅里叶变换点数。 | | dim | axis |傅里叶变换的轴,如果没有指定,默认使用最后一维,仅参数名不一致。| -| norm |norm |傅里叶变换的缩放模式,缩放系数由变换的方向和缩放模式同时决定,默认是 backward。| +| norm |norm |傅里叶变换的缩放模式,缩放系数由变换的方向和缩放模式同时决定,完全一致。| | out | - |输出的 Tensor,Paddle 无此参数,需要进行转写。 | ### 转写示例 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfftn.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfftn.md index d37e661668a..884f2d1d4f6 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfftn.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfftn.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.fft.irfftn +## [ torch 参数更多 ] torch.fft.irfftn ### [torch.fft.irfftn](https://pytorch.org/docs/stable/generated/torch.fft.irfftn.html?highlight=irfftn#torch.fft.irfftn) @@ -28,8 +28,9 @@ paddle.fft.irfftn(x, | input | x |输入 Tensor,仅参数名不一致。 | | s | s |输出 Tensor 在每一个傅里叶变换轴上的长度。 | | dim | axes |计算快速傅里叶变换的轴。仅参数名不一致。 | -| norm |norm |傅里叶变换的缩放模式,缩放系数由变换的方向和缩放模式同时决定,默认是 backward。| +| norm |norm |傅里叶变换的缩放模式,缩放系数由变换的方向和缩放模式同时决定,完全一致。| | out | - |输出的 Tensor,Paddle 无此参数,需要进行转写。 | + ### 转写示例 #### out:指定输出 ```python diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftfreq.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftfreq.md index f31ff1a7eb3..94be8a01a2d 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftfreq.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftfreq.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.fft.rfftfreq +## [ torch 参数更多 ] torch.fft.rfftfreq ### [torch.fft.rfftfreq](https://pytorch.org/docs/1.13/generated/torch.fft.rfftfreq.html?highlight=rfftfreq#torch.fft.rfftfreq) @@ -30,9 +30,9 @@ paddle.fft.rfftfreq(n, | d |d | 采样间隔,采样率的倒数,默认值为 1。 | | out |- |输出的 Tensor,Paddle 无此参数,需要进行转写。 | | dtype |dtype | 返回 Tensor 的数据类型。 | -|layout |- |表示布局方式,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| -|device |- |表示 Tensor 存放设备位置,Paddle 无此参数,需要进行转写。 | -|requires_grad |- |表示是否不阻断梯度传导,Paddle 无此参数,需要进行转写。 | +| layout |- |表示布局方式,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| device |- |表示 Tensor 存放设备位置,Paddle 无此参数,需要进行转写。 | +| requires_grad |- |表示是否不阻断梯度传导,Paddle 无此参数,需要进行转写。 | ### 转写示例 #### out:指定输出 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.download_url_to_file.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.download_url_to_file.md index 86fe14fa20b..400556c5cc3 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.download_url_to_file.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.download_url_to_file.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.hub.download_url_to_file +## [ torch 参数更多 ] torch.hub.download_url_to_file ### [torch.hub.download_url_to_file](https://pytorch.org/docs/1.13/hub.html?highlight=download#torch.hub.download_url_to_file) @@ -23,5 +23,5 @@ paddle.utils.download.get_weights_path_from_url(url, |url |url |下载的链接。| |dst |- |对象将被保存的完整路径,例如:/tmp/temporary_file,Paddle 无此参数,暂无转写方式| |hash_prefix |- |如果不为 None,则下载的 SHA256 文件应以 hash_prefix 开头,默认为 None,Paddle 无此参数,暂无转写方式。| -|progress |- |是否显示进度条。默认值为 True,Paddle 无此参数,可直接删除,| -|- |md5sum |下载文件的 md5 值,默认值:None。Paddle 保持默认即可| +|progress |- |是否显示进度条,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +|- |md5sum |下载文件的 md5 值。Pytorch 无此参数,Paddle 保持默认即可。| diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.help.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.help.md index 1a5b43c6a45..16b1bbb05e7 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.help.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.help.md @@ -19,13 +19,14 @@ paddle.hub.help(repo_dir, force_reload=False) ``` -两者功能一致但参数不一致,部分参数名不同,具体如下: +其中,PyTorch 相比 Paddle 支持更多其他参数,具体如下: + ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| github | repo_dir |repo 地址,支持 git 地址形式和 local 地址,参数名不同。 | -|model | model |模型的名字。 | +| github | repo_dir |repo 地址,支持 git 地址形式和 local 地址,仅参数名不同。 | +| model | model |模型的名字。 | | force_reload | force_reload |指定是否强制拉取,默认值: False。 | -| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,默认为 False,Paddle 无此参数,无需转写。| -| trust_repo | - |在 v1.14 中被移除;Paddle 无此参数,如果对训练无影响,可直接删除。| -|- |source |指定 repo 托管的位置,支持 github、gitee 和 local,默认值 github。| +| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| trust_repo | - |在 v1.14 中被移除;Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +|- |source |指定 repo 托管的位置,Pytorch 无此参数,Paddle 保持默认即可| diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.list.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.list.md index 49b65af13ff..f28ba8a0207 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.list.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.list.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.hub.list +## [ torch 参数更多 ] torch.hub.list ### [torch.hub.list](https://pytorch.org/docs/1.13/hub.html?highlight=hub+list#torch.hub.list) @@ -17,12 +17,14 @@ paddle.hub.list(repo_dir, force_reload=False) ``` -两者功能一致但参数不一致,部分参数名不同,具体如下: + +其中,PyTorch 相比 Paddle 支持更多其他参数,具体如下: + ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| github | repo_dir |repo 地址,支持 git 地址形式和 local 地址,参数名不同。| +| github | repo_dir |repo 地址,支持 git 地址形式和 local 地址,仅参数名不同。| | force_reload | force_reload |指定是否强制拉取,默认值: False。 | -| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,默认为 False,Paddle 无此参数,无需转写。| -| trust_repo | - |在 v1.14 中被移除,Paddle 无此参数,可直接删除。| -|- |source |指定 repo 托管的位置,支持 github、gitee 和 local,默认值:github。Paddle 保持默认即可| +| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| trust_repo | - |在 v1.14 中被移除;Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| - |source |指定 repo 托管的位置,Pytorch 无此参数,Paddle 保持默认即可| diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.load.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.load.md index c7404e41553..30d637ec75e 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.load.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.load.md @@ -1,4 +1,4 @@ -## [torch 参数更多] torch.hub.load +## [ torch 参数更多 ] torch.hub.load ### [torch.hub.load](https://pytorch.org/docs/1.13/hub.html?highlight=hub+load#torch.hub.load) @@ -28,11 +28,12 @@ paddle.hub.load(repo_dir, ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -|repo_or_dir |repo_dir |repo 地址,支持 git 地址形式和 local 地址,参数名不同。| -|model | model |模型的名字。| -|source |source |指定 repo 托管的位置,支持 github、gitee 和 local,默认值:github。| -| trust_repo | - |在 v1.14 中被移除。Paddle 无此参数,可直接删除。| -| force_reload | force_reload |指定是否强制拉取,默认值: False。参数名相同。 | -|verbose | - |如果设置为 False,将不会显示关于命中本地缓存的消息,默认为 True,Paddle 无此参数,直接删除即可。| -| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,默认为 False,Paddle 无此参数,直接删除即可。| -|- |source |指定 repo 托管的位置,支持 github、gitee 和 local,默认值:github。Pytorch 无此参数, Paddle 保持默认即可。| +| repo_or_dir |repo_dir |repo 地址,支持 git 地址形式和 local 地址,仅参数名不同。| +| model | model |模型的名字。| +| *args | - |model 调用时的位置参数。暂时无法转写。| +| source |source |指定 repo 托管的位置。| +| trust_repo | - |在 v1.14 中被移除;Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| force_reload | force_reload |指定是否强制拉取。 | +| verbose | - |是否显示关于命中本地缓存的消息,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。| +| *kwargs | kwargs |model 调用时的关键字参数。| diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/jit/torch.jit.save.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/jit/torch.jit.save.md deleted file mode 100644 index 91358264432..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/jit/torch.jit.save.md +++ /dev/null @@ -1,46 +0,0 @@ -## [torch 参数更多] torch.jit.save - -### [torch.jit.save](https://pytorch.org/docs/1.13/generated/torch.jit.save.html?highlight=save#torch.jit.save) - -```python -torch.jit.save(m, - f, - _extra_files=None) -``` - -### [paddle.jit.save](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/jit/save_cn.html) - -```python -paddle.jit.save(layer, - path, - input_spec=None, - **configs) -``` - -两者功能一致但参数不一致,部分参数名不同,具体如下: -### 参数映射 -| PyTorch | PaddlePaddle | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -|m |layer | 需要存储的 Layer 对象或者 function,参数名不同。 | -|f |- |一个类似文件的对象(必须实现 write 和 flush 方法)或包含文件名的字符串,如果是文件对象,Paddle 暂无转写方式;如果是文件名,则可以用 path 参数实现,需要进行转写。| -|_extra_files |- |文件名到内容的映射,这些内容将作为 f 的一部分进行存储,对应 Paddle 中的 input_spec 参数,需要进行转写。| -|- |path |存储模型的路径前缀,格式为 dirname/file_prefix 或者 file_prefix,对应 PyTorch 的 f 参数。需要进行转写。| -|- |input_spec |描述存储模型 forward 方法的输入,可以通过 InputSpec 或者示例 Tensor 进行描述,对应 PyTorch 中的_extra_files 参数,需要进行转写。| - -### 转写示例 -#### f:一个文件名 -```python -# Pytorch 写法 -torch.jit.save(m, f=filePath) - -# Paddle 写法 -paddle.jit.save(fun, path=filePath) -``` -#### _extra_files: 文件名到内容的映射,这些内容将作为 f 的一部分进行存储 -```python -# Pytorch 写法 -torch.jit.save(m, f=filePath, _extra_files={'foo.txt': b'bar'}) - -# Paddle 写法 -paddle.jit.save(fun, path=filePath, input_spec=list[Tensor]) -``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.add_module.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.add_module.md index 214c266cfcb..ed038ff6b48 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.add_module.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.add_module.md @@ -1,4 +1,4 @@ -## [仅参数名不一致]torch.nn.Module.add_module +## [ 仅参数名不一致 ]torch.nn.Module.add_module ### [torch.nn.Module.add_module](https://pytorch.org/docs/stable/generated/torch.nn.Module.html?highlight=torch+nn+module+add_module#torch.nn.Module.add_module) @@ -12,11 +12,11 @@ torch.nn.Module.add_module(name, module) paddle.nn.Layer.add_sublayer(name, sublayer) ``` -两者功能一致,参数名不一致。 +两者功能一致,仅参数名不一致。 ### 参数映射 | PyTorch | PaddlePaddle | 备注 | -| :-----: | :----------: | :------------------------------------------: | +| ----- | ----- | ------------------------------------------ | | name | name | 表示子层名。 | | module | sublayer | 表示要添加到模块中的子模块,仅参数名不一致。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.apply.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.apply.md index ace8b9519db..a216ef72d03 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.apply.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.apply.md @@ -1,4 +1,4 @@ -## [参数完全一致]torch.nn.Module.apply +## [ 参数完全一致 ]torch.nn.Module.apply ### [torch.nn.Module.apply](https://pytorch.org/docs/stable/generated/torch.nn.Module.html?highlight=torch+nn+module+apply#torch.nn.Module.apply) @@ -17,5 +17,5 @@ paddle.nn.Layer.apply(fn) ### 参数映射 | PyTorch | PaddlePaddle | 备注 | -| :-----: | :----------: | :------------------------: | +| ----- | ---------- | ------------------------ | | fn | fn | 表示应用于每个模块的函数。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleDict.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleDict.md index d4d2bbfb097..d4ce8dfdf21 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleDict.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleDict.md @@ -1,4 +1,4 @@ -## [仅参数名不一致]torch.nn.ModuleDict +## [ 仅参数名不一致 ]torch.nn.ModuleDict ### [torch.nn.ModuleDict](https://pytorch.org/docs/stable/generated/torch.nn.ModuleDict.html?highlight=torch+nn+moduledict#torch.nn.ModuleDict) @@ -17,5 +17,5 @@ class paddle.nn.LayerDict(sublayers=None) ### 参数映射 | PyTorch | PaddlePaddle | 备注 | -| :-----: | :----------: | :----------------------------------------------------------: | +| ----- | ---------- | ---------------------------------------------------------- | | modules | sublayers | 键值对的可迭代对象,值的类型为 paddle.nn.Layer ,参数名不一致。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleList.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleList.md index 0c976cbb320..9c6e8c3094d 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleList.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ModuleList.md @@ -3,13 +3,13 @@ ### [torch.nn.ModuleList](https://pytorch.org/docs/stable/generated/torch.nn.ModuleList.html?highlight=torch+nn+modulelist#torch.nn.ModuleList) ```python -class torch.nn.ModuleList(modules=None) +torch.nn.ModuleList(modules=None) ``` ### [paddle.nn.LayerList](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/LayerList_cn.html) ```python -class paddle.nn.LayerList(sublayers=None) +paddle.nn.LayerList(sublayers=None) ``` 两者功能一致,参数名不一致,具体如下: @@ -17,5 +17,5 @@ class paddle.nn.LayerList(sublayers=None) ### 参数映射 | PyTorch | PaddlePaddle | 备注 | -| :-----: | :----------: | :--------------------------: | +| ----- | ---------- | -------------------------- | | modules | sublayers | 要保存的子层,参数名不一致。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.functional.softmax.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.functional.softmax.md index 349775d12c6..6fcea548b22 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.functional.softmax.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.functional.softmax.md @@ -1,4 +1,4 @@ -## [torch 参数更多]torch.nn.functional.softmax +## [ torch 参数更多 ]torch.nn.functional.softmax ### [torch.nn.functional.softmax](https://pytorch.org/docs/stable/generated/torch.nn.functional.softmax.html#torch.nn.functional.softmax) @@ -21,34 +21,3 @@ paddle.nn.functional.softmax(x, axis=- 1, dtype=None, name=None) | dim | axis | 表示对输入 Tensor 进行运算的轴,仅参数名不一致。 | | dtype | dtype | 表示返回张量所需的数据类型。 | | _stacklevel | - | Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | - - - - -### 转写示例 -```python -# PyTorch 写法 -import torch -import torch.nn.functional as f - -x = torch.Tensor([[[2.0, 3.0, 4.0, 5.0], - [3.0, 4.0, 5.0, 6.0], - [7.0, 8.0, 8.0, 9.0]], - [[1.0, 2.0, 3.0, 4.0], - [5.0, 6.0, 7.0, 8.0], - [6.0, 7.0, 8.0, 9.0]]]) -out = f.softmax(x, dim = 1, dtype='float32') - - -# Paddle 写法 -import paddle -import paddle.nn.functional as F - -x = paddle.to_tensor([[[2.0, 3.0, 4.0, 5.0], - [3.0, 4.0, 5.0, 6.0], - [7.0, 8.0, 8.0, 9.0]], - [[1.0, 2.0, 3.0, 4.0], - [5.0, 6.0, 7.0, 8.0], - [6.0, 7.0, 8.0, 9.0]]],dtype='float32') -out = F.softmax(x) -``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.bernoulli.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.bernoulli.md index 50a5b05495f..2f2f9e987af 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.bernoulli.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.bernoulli.md @@ -1,4 +1,4 @@ -## [torch 参数更多 ]torch.bernoulli +## [ torch 参数更多 ]torch.bernoulli ### [torch.bernoulli](https://pytorch.org/docs/1.13/generated/torch.bernoulli.html#torch.bernoulli) @@ -21,9 +21,9 @@ paddle.bernoulli(x, ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| input | x | 表示输入的 Tensor ,仅参数名不同。 | +| input | x | 表示输入的 Tensor,仅参数名不同。 | | generator | - | 用于采样的伪随机数生成器, Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | -| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | +| out | - | 表示输出的 Tensor,Paddle 无此参数,需要进行转写。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multinomial.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multinomial.md index 2493f038ec0..7415518bb73 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multinomial.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multinomial.md @@ -1,4 +1,4 @@ -## [torch 参数更多 ]torch.multinomial +## [ torch 参数更多 ]torch.multinomial ### [torch.multinomial](https://pytorch.org/docs/1.13/generated/torch.multinomial.html#torch.multinomial) ```python torch.multinomial(input, @@ -20,11 +20,11 @@ paddle.multinomial(x, ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| input | x | 表示输入的 Tensor ,仅参数名不一致。 | +| input | x | 表示输入的 Tensor,仅参数名不一致。 | | num_samples | num_samples | 表示采样的次数。 | | replacement | replacement | 表示是否是可放回的采样。 | | generator | - | 用于采样的伪随机数生成器,PaddlePaddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | -| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | +| out | - | 表示输出的 Tensor,Paddle 无此参数,需要进行转写。 | ### 转写示例 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nonzero.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nonzero.md index 6888dfe53c1..5c4dbdc91e7 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nonzero.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nonzero.md @@ -1,35 +1,35 @@ -## [torch 参数更多 ]torch.nonzero -### [torch.nonzero](https://pytorch.org/docs/1.13/generated/torch.nonzero.html#torch.nonzero) - -```python -torch.nonzero(input, - *, - out=None, - as_tuple=False) -``` - -### [paddle.nonzero](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nonzero_cn.html) - -```python -paddle.nonzero(x, - as_tuple=False) -``` - -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: -### 参数映射 -| PyTorch | PaddlePaddle | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -| input | x | 表示输入的 Tensor ,仅参数名不一致。 | -| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | -| as_tuple | as_tuple | bool 类型表示输出数据的格式,默认 False 时,输出一个张量,True 时输出一组一维张量。 | - - -### 转写示例 -#### out:指定输出 -```python -# Pytorch 写法 -torch.nonzero(torch.tensor([3, 5]), out=y) - -# Paddle 写法 -paddle.assign(paddle.nonzero(paddle.to_tensor([3, 5])), y) -``` +## [ torch 参数更多 ]torch.nonzero +### [torch.nonzero](https://pytorch.org/docs/1.13/generated/torch.nonzero.html#torch.nonzero) + +```python +torch.nonzero(input, + *, + out=None, + as_tuple=False) +``` + +### [paddle.nonzero](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nonzero_cn.html) + +```python +paddle.nonzero(x, + as_tuple=False) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +| ------------- | ------------ | ------------------------------------------------------ | +| input | x | 表示输入的 Tensor ,仅参数名不一致。 | +| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | +| as_tuple | as_tuple | bool 类型表示输出数据的格式,默认 False 时,输出一个张量,True 时输出一组一维张量。 | + + +### 转写示例 +#### out:指定输出 +```python +# Pytorch 写法 +torch.nonzero(torch.tensor([3, 5]), out=y) + +# Paddle 写法 +paddle.assign(paddle.nonzero(paddle.to_tensor([3, 5])), y) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.normal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.normal.md index 687fdb21526..3cd06457a80 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.normal.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.normal.md @@ -1,4 +1,4 @@ -## [torch 参数更多 ]torch.normal +## [ torch 参数更多 ]torch.normal ### [torch.normal](https://pytorch.org/docs/1.13/generated/torch.normal.html#torch.normal) ```python torch.normal(mean, diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.load_state_dict.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.load_state_dict.md index 69581bea3e0..704f0e1f3dd 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.load_state_dict.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.load_state_dict.md @@ -1,4 +1,4 @@ -## [参数完全一致]torch.optim.Optimizer.load_state_dict +## [ 参数完全一致 ]torch.optim.Optimizer.load_state_dict ### [torch.optim.Optimizer.load_state_dict](https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.load_state_dict.html#torch.optim.Optimizer.load_state_dict) @@ -12,10 +12,10 @@ torch.optim.Optimizer.load_state_dict(state_dict) paddle.optimzier.Optimizer.set_state_dict(state_dict) ``` -两者参数完全一致 +两者功能一致,参数完全一致。 ### 参数映射 | PyTorch | PaddlePaddle | 备注 | -| :--------: | :----------: | :----------------: | +| -------- | ---------- | ---------------- | | state_dict | state_dict | 表示优化器的状态。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.state_dict.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.state_dict.md index 260ad67ba96..67ff606aa90 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.state_dict.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.optim.Optimizer.state_dict.md @@ -1,4 +1,4 @@ -## [无参数]torch.optim.Optimizer.state_dict +## [ 无参数 ]torch.optim.Optimizer.state_dict ### [torch.optim.Optimizer.state_dict](https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.state_dict.html?highlight=torch+optim+optimizer+state_dict#torch.optim.Optimizer.state_dict) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.poisson.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.poisson.md index a8430605dca..91e51fa4a01 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.poisson.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.poisson.md @@ -1,4 +1,4 @@ -## [torch 参数更多 ]torch.poisson +## [ torch 参数更多 ]torch.poisson ### [torch.poisson](https://pytorch.org/docs/1.13/generated/torch.poisson.html#torch.poisson) ```python torch.poisson(input, diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.scatter_add.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.scatter_add.md index 8a4822df814..974f99d9890 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.scatter_add.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.scatter_add.md @@ -28,4 +28,4 @@ paddle.put_along_axis(arr, | dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 | | index | indices | 表示输入的索引张量,仅参数名不一致。 | | src | values | 表示需要插入的值,仅参数名不一致。 | -| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数, Paddle 应设置此参数为 add 。| +| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数, Paddle 应设置为 'add' 。| diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.set_printoptions.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.set_printoptions.md index d7e938bf59f..ce9d18c0f64 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.set_printoptions.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.set_printoptions.md @@ -1,4 +1,4 @@ -## [torch 参数更多]torch.set_printoptions +## [ torch 参数更多 ]torch.set_printoptions ### [torch.set_printoptions](https://pytorch.org/docs/stable/generated/torch.set_printoptions.html?highlight=torch+set_printoptions#torch.set_printoptions) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sparse_coo_tensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sparse_coo_tensor.md index e2f21abf345..961092e4c6d 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sparse_coo_tensor.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sparse_coo_tensor.md @@ -1,9 +1,9 @@ -## [torch 参数更多]torch.sparse_coo_tensor +## [ 参数不一致 ]torch.sparse_coo_tensor ### [torch.sparse_coo_tensor](https://pytorch.org/docs/stable/generated/torch.sparse_coo_tensor.html?highlight=torch+sparse_coo_tensor#torch.sparse_coo_tensor) ```python -torch.sparse_coo_tensor(indices,values,size=None,*,dtype=None,device=None,requires_grad=False) +torch.sparse_coo_tensor(indices,values,size=None, * , dtype=None,device=None,requires_grad=False) ``` ### [paddle.sparse.sparse_coo_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/sparse/sparse_coo_tensor_cn.html#sparse-coo-tensor) @@ -17,13 +17,13 @@ paddle.sparse.sparse_coo_tensor(indices, values, shape=None, dtype=None, place=N ### 参数映射 | PyTorch | PaddlePaddle | 备注 | -| :-----------: | :-----------: | :-----------------------------------------: | +| ----------- | ----------- | ----------------------------------------- | | indices | indices | 表示初始化 tensor 的数据。 | | values | values | 表示初始化 tensor 的数据。 | | dtype | dtype | 表示创建 tensor 的数据类型。 | | size | shape | 表示张量的大小,仅参数名不一致。 | | device | place | 表示创建 tensor 的设备位置,仅参数名不一致。 | -| requires_grad | stop_gradient | 参数代表含义不相同,需要进行转写。 | +| requires_grad | stop_gradient | 两者参数功能相反,需要进行转写。 | ### 转写示例 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.stack.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.stack.md index ee49c2e69e7..99cad0f19db 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.stack.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.stack.md @@ -1,4 +1,4 @@ -## [torch 参数更多 ]torch.stack +## [ torch 参数更多 ]torch.stack ### [torch.stack](https://pytorch.org/docs/1.13/generated/torch.stack.html#torch.stack) ```python