Skip to content

Commit 5ebfc20

Browse files
authored
【Hackathon No.21】为 Paddle 新增 paddle.incubate.sparse.transpose 稀疏 API (#5272)
* add paddle.incubate.sparse.transpose docs * modified docs * modified docs * modified docs * modified docs * modified docs
1 parent 33ab3dc commit 5ebfc20

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

docs/api/paddle/incubate/sparse/Overview_cn.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ paddle.incubate.sparse 目录包含飞桨框架支持稀疏数据存储和计算
5757
" :ref:`paddle.incubate.sparse.divide <cn_api_paddle_incubate_sparse_divide>` ", "对稀疏 Tensor 逐元素相除"
5858
" :ref:`paddle.incubate.sparse.is_same_shape <cn_api_paddle_incubate_sparse_is_same_shape>` ", "判断两个稀疏 Tensor 或稠密 Tensor 的 shape 是否一致"
5959
" :ref:`paddle.incubate.sparse.reshape <cn_api_paddle_incubate_sparse_reshape>` ", "改变一个 SparseTensor 的形状"
60+
" :ref:`paddle.incubate.sparse.transpose <cn_api_paddle_incubate_sparse_transpose>` ", "在不改变数据的情况下改变 ``x`` 的维度顺序, 支持 COO 格式的多维 SparseTensor 以及 COO 格式的 2 维和 3 维 SparseTensor"
6061

6162
.. _about_sparse_nn:
6263

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. _cn_api_paddle_incubate_sparse_transpose:
2+
3+
transpose
4+
-------------------------------
5+
6+
.. py:function:: paddle.incubate.sparse.transpose(x, perm, name=None)
7+
8+
9+
根据 :attr:`perm` 对输入的 :attr:`x` 维度进行重排,但不改变数据,
10+
:attr:`x` 必须是多维 SparseTensor 或 COO 格式的 2 维或 3 维 SparseTensor。
11+
12+
.. math::
13+
out = transpose(x, perm)
14+
15+
参数
16+
:::::::::
17+
- **x** (Tensor) - 输入的 Tensor,数据类型为 float32、float64、int32 或 int64。
18+
- **perm** (list|tuple) - :attr:`perm` 长度必须和 :attr:`x` 的维度相同,并依照 :attr:`perm` 中数据进行重排。
19+
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。
20+
21+
返回
22+
:::::::::
23+
转置后的稀疏张量, 数据类型和压缩格式与 :attr:`x` 相同。
24+
25+
26+
代码示例
27+
:::::::::
28+
29+
COPY-FROM: paddle.incubate.sparse.transpose

0 commit comments

Comments
 (0)