Question on reshape(prog assignment 1)

I have a question regarding reshape.

lets say X is an array with X.shape=(50,50,50,3)

both X.reshape(-1,X.shape[0]) and X.reshape(X.shape[0],-1).T will have the same shape (7500,50).

But they don’t seem to be the same array. Is there is a reason for this difference? Has it got something to do with the axis along which reshape is done?

If so, is one preferred over the other?

It’s an interesting question! It turns out that the first method “scrambles” the data making it meaningless. Just because the shapes end up the same does not mean the two methods are equivalent, but there are multiple ways to get a useful answer. Here is a thread which explains in detail why the two methods are different. Make sure to read that thread all the way through to the discussion about “F” versus “C” order.

Thank you, that example was extremely helpful!

Its is the super example it is very helpful thank you