Skip to content
Merged
Changes from 2 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
34 changes: 23 additions & 11 deletions paddle/operators/transpose_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,29 @@ Transpose Operator.
The input tensor will be permuted according to the axis values given.
The op functions is similar to how numpy.transpose works in python.

For example: input = numpy.arange(6).reshape((2,3))
the input is:
array([[0, 1, 2],
[3, 4, 5]])
given axis is: [1, 0]

output = input.transpose(axis)
then the output is:
array([[0, 3],
[1, 4],
[2, 5]])
For example:

.. code-block:: python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python or text,please try to compare the preview

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. text is more fitting here.


input = numpy.arange(6).reshape((2,3))

the input is:

array([[0, 1, 2],
[3, 4, 5]])

given axis is:

[1, 0]

output = input.transpose(axis)

then the output is:

array([[0, 3],
[1, 4],
[2, 5]])

So, given a input tensor of shape(N, C, H, W) and the axis is {0, 2, 3, 1},
the output tensor shape will be (N, H, W, C)

Expand Down