未验证 提交 918d2456 编写于 作者: W wangchaochaohu 提交者: GitHub

add doc for chunk Ops (#2454)

上级 c27c202c
......@@ -23,6 +23,7 @@ paddle
paddle/cast.rst
paddle/ceil.rst
paddle/cholesky.rst
paddle/chunk.rst
paddle/clamp.rst
paddle/CompiledProgram.rst
paddle/concat.rst
......
......@@ -16,6 +16,7 @@ paddle.tensor
tensor/atan.rst
tensor/cast.rst
tensor/ceil.rst
tensor/chunk.rst
tensor/concat.rst
tensor/cos.rst
tensor/create_tensor.rst
......
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_tensor_chunk:
chunk
---
.. autofunction:: paddle.tensor.chunk
:noindex:
......@@ -21,6 +21,8 @@ paddle
paddle_cn/cast_cn.rst
paddle_cn/ceil_cn.rst
paddle_cn/cholesky_cn.rst
paddle_cn/chunk_cn.rst
paddle_cn/clamp_cn.rst
paddle_cn/clip_cn.rst
paddle_cn/CompiledProgram_cn.rst
paddle_cn/concat_cn.rst
......
......@@ -23,6 +23,8 @@ paddle.tensor
tensor_cn/cast_cn.rst
tensor_cn/ceil_cn.rst
tensor_cn/cholesky_cn.rst
tensor_cn/chunk_cn.rst
tensor_cn/clamp_cn.rst
tensor_cn/clip_cn.rst
tensor_cn/concat_cn.rst
tensor_cn/cond_cn.rst
......@@ -166,3 +168,4 @@ paddle.tensor
tensor_cn/where_cn.rst
tensor_cn/zeros_cn.rst
tensor_cn/zeros_like_cn.rst
.. _cn_api_tensor_cn_chunk:
chunk
-------------------------------
.. py:function:: paddle.chunk(x, chunks, axis=0, name=None)
该OP将输入Tensor分割成多个子Tensor。
**参数**:
- **x** (Tensor) - 输入变量,数据类型为bool, float16, float32,float64,int32,int64的多维Tensor。
- **chunks** (int) - 如果 ``chunks`` 是一个整数,则表示Tensor平均划分为相同大小子Tensor的数量。
- **axis** (int|Tensor,可选) - 整数或者形状为[1]的Tensor,数据类型为int32或int64。表示需要分割的维度。如果 ``axis < 0`` ,则划分的维度为 ``rank(x) + axis`` 。默认值为0。
- **name** (str,可选) – 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。
返回:分割后的Tensor列表。
**代码示例**
.. code-block:: python
import numpy as np
import paddle
paddle.disable_static()
# x is a Tensor which shape is [3, 9, 5]
x_np = np.random.random([3, 9, 5]).astype("int32")
x = paddle.to_tensor(x_np)
out0, out1, out22 = paddle.chunk(x, chunks=3, axis=1)
# out0.shape [3, 3, 5]
# out1.shape [3, 3, 5]
# out2.shape [3, 3, 5]
# axis is negative, the real axis is (rank(x) + axis) which real
# value is 1.
out0, out1, out2 = paddle.chunk(x, chunks=3, axis=-2)
# out0.shape [3, 3, 5]
# out1.shape [3, 3, 5]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册