Looking at numpy.transpose , we find that transpose takes an argument
axes : int list, optional
Resize by default, otherwise move the axes according to the specified values.
Thus, the default transpose call is converted by default to np.transpose(a, axes=[1,0]) for 2D code or np.transpose(a, axes=[2,1,0]) .
The operation you want to have here is one that leaves the depth dimension unchanged. Therefore, in the argument of the axes, the depth axes, which are the 0 axes, must remain unchanged. Axes 1 and 2 (where 1 is the vertical axis), you need to change positions. Thus, you change the order of the axes from the initial [0,1,2] to [0,2,1] ( [stays the same, changes with other, changes with other] ).
For some reason, they are renamed axes in perm in the tensor flow. The argument above remains the same.
Images
In terms of images, they differ from arrays in question. Typically, images have x and y stored in the first two dimensions, and the channel in the last, [y,x,channel] .
To βtransposeβ an image in the sense of a 2D transposition, where the horizontal and vertical axes change, you will need to use
np.transpose(a, axes=[1,0,2])
(the channel remains the same, x and y are exchanged).
