Skip to content

Commit

Permalink
Fix paddle.t api docs (#5146)
Browse files Browse the repository at this point in the history
* fix paddle.t api docs

* fix paddle.t api docs
  • Loading branch information
heliqi authored Aug 17, 2022
1 parent 73522d0 commit 8e0cb1f
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions docs/api/paddle/t_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@ t
Tensor,0 维和 1 维 Tensor 返回本身,2 维 Tensor 返回转置 Tensor。

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

.. code-block:: text
# 例 1 (0-D tensor)
x = tensor([0.79])
paddle.t(x) = tensor([0.79])
# 例 2 (1-D tensor)
x = tensor([0.79, 0.84, 0.32])
paddle.t(x) = tensor([0.79, 0.84, 0.32])
# 例 3 (2-D tensor)
x = tensor([0.79, 0.84, 0.32],
[0.64, 0.14, 0.57])
paddle.t(x) = tensor([0.79, 0.64],
[0.84, 0.14],
[0.32, 0.57])
代码示例
::::::::::::

.. code-block:: python
COPY-FROM: <paddle.t>:<code-example>
import paddle
x = paddle.ones(shape=[2, 3], dtype='int32')
x_transposed = paddle.t(x)
print(x_transposed.shape)
# [3, 2]

0 comments on commit 8e0cb1f

Please sign in to comment.