Q:

Write a NumPy program to move the specified axis backwards, until it lies in a given position. Move the following 3rd array axes to first position. (2,3,4,5)

0

Write a NumPy program to move the specified axis backwards, until it lies in a given position.
Move the following 3rd array axes to first position.
(2,3,4,5)

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.ones((2,3,4,5))
print(np.rollaxis(x, 3, 1).shape)

Sample Output:

(2, 5, 3, 4)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now