np.zeros((1, 3, 1)) has two useless axes

NumPy · from Adding, removing and moving axes

np.newaxisnp.expand_dims.squeeze()np.swapaxesnp.moveaxis.transpose(axes)

Putting the kettle on…

Starting up…

Exercise 2

np.zeros((1, 3, 1)) has two useless axes. Return its shape after removing all length-1 axes.

your answer
stuck? the lesson behind it
Adding, removing and moving axes
newaxis, squeeze, moveaxis — the tools for making shapes line up.