Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion docs/api/paddle/dsplit_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ dsplit
.. py:function:: paddle.dsplit(x, num_or_indices, name=None)


``dsplit`` 全称 Depth Split ,即深度分割,将输入 Tensor 沿着深度轴分割成多个子 Tensor,等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 2。注意:使用 ``paddle.dsplit`` 进行变换的 Tensor 维度数量必须不少于 3。

将输入 Tensor 沿着深度轴分割成多个子 Tensor,等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 2。
如下图,Tenser ``x`` 的 shape 为[4, 4, 4],经过 ``paddle.dsplit(x, num_or_indices=2)`` 变换后,得到 ``out0`` 和 ``out1`` 两个 shape 均为[4, 4, 2]的子 Tensor :

.. image:: ../../images/api_legend/dsplit/dsplit.png
:alt: dsplit 图例

参数
:::::::::
Expand Down
12 changes: 11 additions & 1 deletion docs/api/paddle/hsplit_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ hsplit



将输入 Tensor 沿着水平轴分割成多个子 Tensor。当 x 的维度大于 1 时等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 1,当 x 的维度等于 1 时等价于将 paddle.tensor_split API 的参数 axis 固定为 0。
``hsplit`` 全称 Horizontal Split ,即水平分割,将输入 Tensor 沿着水平轴分割成多个子 Tensor,存在以下两种情况:

1. 当 x 的维度等于 1 时,等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 0;

.. image:: ../../images/api_legend/hsplit/hsplit-1.png
:alt: 当 x 的维度等于 1 时

2. 当 x 的维度大于 1 时,等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 1。

.. image:: ../../images/api_legend/hsplit/hsplit-2.png
:alt: 当 x 的维度大于 1 时

参数
:::::::::
Expand Down
41 changes: 38 additions & 3 deletions docs/api/paddle/tensor_split_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tensor_split
参数
:::::::::
- **x** (Tensor) - 输入变量,数据类型为 bool、bfloat16、float16、float32、float64、uint8、int8、int32、int64 的多维 Tensor,其维度必须大于 0。
- **num_or_indices** (int|list|tuple) - 如果 ``num_or_indices`` 是一个整数 ``n`` ,则 ``x`` 沿 ``axis`` 拆分为 ``n`` 部分。如果 ``x`` 可被 ``n`` 整除,则每个部分都是 ``x.shape[axis]/n`` 。如果 ``x`` 不能被 ``n`` 整除,则第一个 ``intx.shape[axis]%n)`` 分割大小将为 ``intx.shape[axis]/n)+1`` ,其余部分的大小将是 ``intx.shape[axis]/n`` 。如果 ``num_or_indices`` 是整数索引的列表或元组,则在每个索引处沿 ``axis`` 分割 ``x`` 。例如, ``num_or_indices=[2, 4]`` 在 ``axis=0`` 时将沿轴 0 将 ``x`` 拆分为 ``x[:2]`` 、 ``x[2:4]`` 和 ``x[4:]`` 。
- **num_or_indices** (int|list|tuple) - 如果 ``num_or_indices`` 是一个整数 ``n`` ,则 ``x`` 沿 ``axis`` 拆分为 ``n`` 部分。如果 ``x`` 可被 ``n`` 整除,则每个部分都是 ``x.shape[axis]/n`` 。如果 ``x`` 不能被 ``n`` 整除,则第 ``int(x.shape[axis]/n)+1`` 个部分的大小将是 ``int(x.shape[axis]%n)`` ,其余部分的大小将是 ``int(x.shape[axis]/n)`` 。如果 ``num_or_indices`` 是整数索引的列表或元组,则在每个索引处沿 ``axis`` 分割 ``x`` 。例如, ``num_or_indices=[2, 4]`` 在 ``axis=0`` 时将沿轴 0 将 ``x`` 拆分为 ``x[:2]`` 、 ``x[2:4]`` 和 ``x[4:]`` 。
- **axis** (int|Tensor,可选) - 整数或者形状为[]的 0-D Tensor,数据类型为 int32 或 int64。表示需要分割的维度。如果 ``axis < 0``,则划分的维度为 ``rank(x) + axis`` 。默认值为 0。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

Expand All @@ -22,7 +22,42 @@ tensor_split
list[Tensor],分割后的 Tensor 列表。


代码示例
代码示例 1
:::::::::

COPY-FROM: paddle.tensor_split
COPY-FROM: paddle.tensor_split:code-example-1

.. image:: ../../images/api_legend/tensor_split/tensor_split-1.png
:alt: 图例-1

代码示例 2
:::::::::::

COPY-FROM: paddle.tensor_split:code-example-2

.. image:: ../../images/api_legend/tensor_split/tensor_split-2.png
:alt: 图例-2

代码示例 3
:::::::::::

COPY-FROM: paddle.tensor_split:code-example-3

.. image:: ../../images/api_legend/tensor_split/tensor_split-3.png
:alt: 图例-3

代码示例 4
:::::::::::

COPY-FROM: paddle.tensor_split:code-example-4

.. image:: ../../images/api_legend/tensor_split/tensor_split-4.png
:alt: 图例-4

代码示例 5
:::::::::::

COPY-FROM: paddle.tensor_split:code-example-5

.. image:: ../../images/api_legend/tensor_split/tensor_split-5.png
:alt: 图例-5
12 changes: 11 additions & 1 deletion docs/api/paddle/vsplit_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ vsplit



将输入 Tensor 沿着垂直轴分割成多个子 Tensor,等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 0。
``vsplit`` 全称 Vertical Split 即垂直分割) - 用于将张量沿垂直方向分割成多个子张量。 轴分割成多个子 Tensor,将输入 Tensor 沿着垂直轴分割成多个子 Tensor,等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 0。

当 Tensor 维度数量为 1 时:

.. image:: ../../images/api_legend/vsplit/vsplit-1.png
:alt: vsplit 图例-1

当 Tensor 维度数量大于 1 时:

.. image:: ../../images/api_legend/vsplit/vsplit-2.png
:alt: vsplit 图例-2

参数
:::::::::
Expand Down
Binary file added docs/images/api_legend/dsplit/dsplit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/api_legend/hsplit/hsplit-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/api_legend/hsplit/hsplit-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/api_legend/vsplit/vsplit-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/api_legend/vsplit/vsplit-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.