I understand what the matrix.T and X.shape[0] do, but how is the parameter “-1” interpreted here? What other parameters can be here instead of “-1”.

In the optional practice assignment- “Python_Basics_with_Numpy”, Exercise 5 it is mentioned: *“You can use v = v.reshape(-1, 1). Just make sure you understand why it works.”* There we were reshaping a 3 dimensional (num_px, num_px, 3) matrix into a (num_px * num_px * 3, 1) column vector. There “-1” was the first parameter in the .reshape() method.

Is this “trick” specific to Numpy?

Can I get a link to the documentation where this “trick” is explained? I hate to just memorize stuff without understanding how it works.

If I type in X_flatten = X.reshape((X.shape[0], X.shape[1] * X.shape[2]*X.shape[2])).T , where X stands for “train_set_x_orig”, the AutoGrader returned correct result as well.