diff --git a/paddle/operators/transpose_op.cc b/paddle/operators/transpose_op.cc index 382f6a9740c0402ac4f5d4704ccb0ad9ce578c27..11615d806a61b3525d2ed50f5ea5940e8d61c8f8 100644 --- a/paddle/operators/transpose_op.cc +++ b/paddle/operators/transpose_op.cc @@ -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:: text + + 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)