forked from PaddlePaddle/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Add] hack5 31 doc (PaddlePaddle#6394)
- Loading branch information
Showing
12 changed files
with
190 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _cn_api_paddle_column_stack: | ||
|
||
column_stack | ||
------------------------------- | ||
|
||
.. py:function:: paddle.column_stack(x, name=None) | ||
沿水平轴堆叠输入 ``x`` 中的所有张量。 ``x`` 中的每个张量 ``tensor`` 如果在堆叠之前 ``tensor.ndim < 2`` ,则首先被整形为 ``(tensor.numel(), 1)``。所有张量必须具有相同的数据类型。 | ||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple, ``x`` 中张量的数据类型必须相同。支持的数据类型: ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
:::::::::::: | ||
Tensor,与输入数据类型相同的堆叠张量。 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.column_stack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _cn_api_paddle_dstack: | ||
|
||
dstack | ||
------------------------------- | ||
|
||
.. py:function:: paddle.dstack(x, name=None) | ||
沿深度轴堆叠输入 ``x`` 中的所有张量。所有张量必须具有相同的数据类型。 | ||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple, ``x`` 中张量的数据类型必须相同。支持的数据类型: ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
:::::::::::: | ||
Tensor,与输入数据类型相同的堆叠张量。 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.dstack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _cn_api_paddle_hstack: | ||
|
||
hstack | ||
------------------------------- | ||
|
||
.. py:function:: paddle.hstack(x, name=None) | ||
沿水平轴堆叠输入 ``x`` 中的所有张量。所有张量必须具有相同的数据类型。 | ||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple, ``x`` 中张量的数据类型必须相同。支持的数据类型: ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
:::::::::::: | ||
Tensor,与输入数据类型相同的堆叠张量。 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.hstack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _cn_api_paddle_row_stack: | ||
|
||
row_stack | ||
------------------------------- | ||
|
||
.. py:function:: paddle.row_stack(x, name=None) | ||
:ref:`cn_api_paddle_vstack` 的别名。沿垂直轴堆叠输入 ``x`` 中的所有张量。所有张量必须具有相同的数据类型。 | ||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple, ``x`` 中张量的数据类型必须相同。支持的数据类型: ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
:::::::::::: | ||
Tensor,与输入数据类型相同的堆叠张量。 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.row_stack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _cn_api_paddle_vstack: | ||
|
||
vstack | ||
------------------------------- | ||
|
||
.. py:function:: paddle.vstack(x, name=None) | ||
沿垂直轴堆叠输入 ``x`` 中的所有张量。所有张量必须具有相同的数据类型。 | ||
|
||
参数 | ||
:::::::::::: | ||
|
||
- **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple, ``x`` 中张量的数据类型必须相同。支持的数据类型: ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。 | ||
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
||
返回 | ||
:::::::::::: | ||
Tensor,与输入数据类型相同的堆叠张量。 | ||
|
||
代码示例 | ||
:::::::::::: | ||
|
||
COPY-FROM: paddle.vstack |
23 changes: 11 additions & 12 deletions
23
...des/model_convert/convert_from_pytorch/api_difference/ops/torch.column_stack.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
## [ 组合替代实现 ]torch.column_stack | ||
## [ 仅参数名不一致 ]torch.column_stack | ||
|
||
### [torch.column_stack](https://pytorch.org/docs/stable/generated/torch.column_stack.html#torch.column_stack) | ||
|
||
```python | ||
torch.column_stack(tensors, *, out=None) | ||
``` | ||
|
||
按水平方向拼接张量; Paddle 无此 API,需要组合实现。 | ||
|
||
### 转写示例 | ||
### [paddle.column_stack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/column_stack_cn.html) | ||
|
||
```python | ||
# Pytorch 写法 | ||
y = torch.column_stack((a, b)) | ||
|
||
# Paddle 写法 | ||
if a.ndim == 1: | ||
y = paddle.stack((a, b), axis=1) | ||
else: | ||
y = paddle.concat((a, b), axis=1) | ||
paddle.column_stack(x, name=None) | ||
``` | ||
|
||
其中 Paddle 相比 Pytorch 仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| tensors | x | 表示输入的 Tensor ,仅参数名不一致。 | |
21 changes: 21 additions & 0 deletions
21
docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.dstack.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## [ 仅参数名不一致 ]torch.dstack | ||
|
||
### [torch.dstack](https://pytorch.org/docs/stable/generated/torch.dstack.html#torch.dstack) | ||
|
||
```python | ||
torch.dstack(tensors, *, out=None) | ||
``` | ||
|
||
### [paddle.dstack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/dstack_cn.html) | ||
|
||
```python | ||
paddle.dstack(x, name=None) | ||
``` | ||
|
||
其中 Paddle 相比 Pytorch 仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| tensors | x | 表示输入的 Tensor ,仅参数名不一致。 | |
23 changes: 11 additions & 12 deletions
23
docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.hstack.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
## [ 组合替代实现 ]torch.hstack | ||
## [ 仅参数名不一致 ]torch.hstack | ||
|
||
### [torch.hstack](https://pytorch.org/docs/stable/generated/torch.hstack.html#torch.hstack) | ||
|
||
```python | ||
torch.hstack(tensors, *, out=None) | ||
``` | ||
|
||
按水平方向拼接张量; Paddle 无此 API,需要组合实现。 | ||
|
||
### 转写示例 | ||
### [paddle.hstack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hstack_cn.html) | ||
|
||
```python | ||
# Pytorch 写法 | ||
y = torch.hstack((a, b)) | ||
|
||
# Paddle 写法 | ||
if a.ndim == 1: | ||
y = paddle.concat((a, b), axis=0) | ||
else: | ||
y = paddle.concat((a, b), axis=1) | ||
paddle.hstack(x, name=None) | ||
``` | ||
|
||
其中 Paddle 相比 Pytorch 仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| tensors | x | 表示输入的 Tensor ,仅参数名不一致。 | |
23 changes: 11 additions & 12 deletions
23
...guides/model_convert/convert_from_pytorch/api_difference/ops/torch.row_stack.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
## [ 组合替代实现 ]torch.row_stack | ||
## [ 仅参数名不一致 ]torch.row_stack | ||
|
||
### [torch.row_stack](https://pytorch.org/docs/stable/generated/torch.row_stack.html#torch.row_stack) | ||
|
||
```python | ||
torch.row_stack(tensors, *, out=None) | ||
``` | ||
|
||
按垂直方向拼接张量; Paddle 无此 API,需要组合实现。 | ||
|
||
### 转写示例 | ||
### [paddle.row_stack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/row_stack_cn.html) | ||
|
||
```python | ||
# Pytorch 写法 | ||
y = torch.row_stack((a, b)) | ||
|
||
# Paddle 写法 | ||
if a.ndim == 1: | ||
y = paddle.stack((a, b)) | ||
else: | ||
y = paddle.concat((a, b)) | ||
paddle.row_stack(x, name=None) | ||
``` | ||
|
||
其中 Paddle 相比 Pytorch 仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| tensors | x | 表示输入的 Tensor ,仅参数名不一致。 | |
23 changes: 11 additions & 12 deletions
23
docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.vstack.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
## [ 组合替代实现 ]torch.vstack | ||
## [ 仅参数名不一致 ]torch.vstack | ||
|
||
### [torch.vstack](https://pytorch.org/docs/stable/generated/torch.vstack.html#torch.vstack) | ||
|
||
```python | ||
torch.vstack(tensors, *, out=None) | ||
``` | ||
|
||
按垂直方向拼接张量; Paddle 无此 API,需要组合实现。 | ||
|
||
### 转写示例 | ||
### [paddle.vstack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vstack_cn.html) | ||
|
||
```python | ||
# Pytorch 写法 | ||
y = torch.vstack((a, b)) | ||
|
||
# Paddle 写法 | ||
if a.ndim == 1: | ||
y = paddle.stack((a, b)) | ||
else: | ||
y = paddle.concat((a, b)) | ||
paddle.vstack(x, name=None) | ||
``` | ||
|
||
其中 Paddle 相比 Pytorch 仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| tensors | x | 表示输入的 Tensor ,仅参数名不一致。 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters