Skip to content

Commit a0e8894

Browse files
Merge pull request #7020 from wanghaoshuang/fix_transpose_doc
Fix transpose doc
2 parents c77b696 + 835a4d1 commit a0e8894

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

paddle/operators/transpose_op.cc

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,29 @@ Transpose Operator.
7272
The input tensor will be permuted according to the axis values given.
7373
The op functions is similar to how numpy.transpose works in python.
7474
75-
For example: input = numpy.arange(6).reshape((2,3))
76-
the input is:
77-
array([[0, 1, 2],
78-
[3, 4, 5]])
79-
given axis is: [1, 0]
80-
81-
output = input.transpose(axis)
82-
then the output is:
83-
array([[0, 3],
84-
[1, 4],
85-
[2, 5]])
75+
For example:
76+
77+
.. code-block:: text
78+
79+
input = numpy.arange(6).reshape((2,3))
80+
81+
the input is:
82+
83+
array([[0, 1, 2],
84+
[3, 4, 5]])
85+
86+
given axis is:
87+
88+
[1, 0]
89+
90+
output = input.transpose(axis)
91+
92+
then the output is:
93+
94+
array([[0, 3],
95+
[1, 4],
96+
[2, 5]])
97+
8698
So, given a input tensor of shape(N, C, H, W) and the axis is {0, 2, 3, 1},
8799
the output tensor shape will be (N, H, W, C)
88100

0 commit comments

Comments
 (0)