How to transpose axes back after .transpose?


I'm wonder how can I undo my transpose operation. Let me be more specific in example:

a = np.random.rand(25,32,11) 
b = a.transpose(2,0,1)
c = b.transpose(??) ### Here I should set (1,0,2) 
# c == a

Which exactly values should I set in last transpose to make c == a ? In numpy there is not such method as "transpose_undo" I guess. As an solution we can rely on actual shape of array, but we can have 25x25x25 array in the future...

Copyright License:
Author:「Андрей Севостьянов」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/67938346/how-to-transpose-axes-back-after-transpose

About “How to transpose axes back after .transpose?” questions

I'm wonder how can I undo my transpose operation. Let me be more specific in example: a = np.random.rand(25,32,11) b = a.transpose(2,0,1) c = b.transpose(??) ### Here I should set (1,0,2) # c == a
suppose I have an array of shape (2,2,3): x=np.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]]), and I have transposed this array to y along axes (2,0,1): y=np.transpose(x,(2,0,1)). My questions is,...
Everything is in the title. I have a RaggedTensor of shape (nsamples, None, M1), and I would like to transpose the last two axes to get a RaggedTensor of shape (nsamples, M1, None). tf.transpose do...
I have a tensor of unknown shape, but it is at least 3 dimensional, i.e. shape=[a, b, c, ...]. I would like to switch dimensions a and b, without knowing how long the tensor is (so I can't use tf.
I would like to style my data for some data analysis. This works well with df.style, which I have only recently discovered. I seem to be missing one crucial aspect, however: how can you transpose a
Traceback Error Traceback (most recent call last): File "C:\Users\trial2\trial.py", line 55, in <module> image_stack(image) File "C:\Users\trial2\trial.py", line 41, in
Yelo! This is my understanding of np.transpose(arr, perm_pos): Say we want to move axes of a 3D np.ndarray to specific positions in the transposed ndarray, we essentially specify the perm_pos to the
I load (an) image(s) via batches =datagen.flow_from_directory(...) I want to plot a sample image to see the augmentations by the datagnerator. display(img_batch[0].shape) shows me (1, 256, 256...
I have a list with 2 cells, each of them is 3 dimension array, one is 3 by 4 by 5, the other is 6 by 7 by 8. Need to transpose the subset in the list to be like: 5 by 4 by 3, and 8 by 7 by 6, I used
How could I apply the transpose operator after it has returned the nominal expression? I'm working with some symbolic matrix equations, and I have to deal with the transpose, after that I need to

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.