C1-W3-Assignment

In exercise 2 my expected output is correct but I can’t get the unit test to pass. Any idea of what I am doing wrong?

My code is:
# Size of input layer.
n_x = 1
# Size of output layer.
n_y = 1
### END CODE HERE ###
return (n_x, n_y)

Unit test results:
Wrong size of the input layer n_x for the test case, where array X has a shape (5, 100).
Expected: 5.
Got: 1.
Wrong size of the output layer n_y for the test case, where array Y has a shape (3, 100).
Expected: 3.
Got: 1.

I presume you’re working on this function?

Nothing tells you to hard-code the values to 1.
The Hints tell you to use the shape attributes of X and Y.

Thanks for the reply. Do I have to redefine X and Y in the function?

No. Use X.shape[…] and Y.shape[…], with the appropriate index values. I think you can figure out the indices from the code used in the asserts.

Got it. Thank you!

I am getting similar error upon executing shape_X[…] and shape_Y[…]

upon running the unit test (w3_unittest.test_layer_sizes(layer_sizes), I received:

Wrong size of the input layer n_x for the test case, where array X has a shape (5, 100).
Expected: 5.
Got: 1.
Wrong size of the output layer n_y for the test case, where array Y has a shape (3, 100).
Expected: 3.
Got: 1.

Could you please help with resolving this? Thanks

Did you replace the “…” with the correct integer index?

Yes, I used 0 index of the shape tuple for X and Y. Is that not correct?

Please check your personal messages for instructions.