Questions about the X shape

When I doing the assignment in W3A1/Planar_data_classification_with_one_hidden_layer. In Exercise 2 - layer_sizes, even though I finished and passed the test, I didn’t clearly understand why the n_x = X.shape[0] is 5, because, in exercise 1, we know shape_X, the X is (2, 400). Following are the pictures of these two code blocks and the results.

Hello, Fei Xing.

First of all, please remove the codes. Its a violation to share the codes at this platform.

For your query, please have a look at this link & this one.

OK, I’ll remove the code. And thanks for your reply.

Why X.shape[0] is different from shape_X[0]?

But point is that shape_X is just a python variable with no defined relationship to X, meaning that you need to know how the previous code was written in order to know whether those two expressions are the same. If you previously wrote:

shape_X = X.shape

then those two will be the same. But that extra line of code is just that (“extra”) if you can just write X.shape[0] and be done with it.