Hello!

I’m getting “ValueError: shapes (1,3) and (2,2000) not aligned” in the unit test for the "forward_propagation " function where I calculate Z2 using W2. W2 shouldn’t be (1,3) because it has hardcoded dimension n_h = 2 (it was set in the “layer_sizes” function and assigned in the “initialize_parameters” function with the value np.random.randn(n_y, n_h)). Is there a mistake in the unit test itself?

No, there is no mistake in the unit tests. The tests are independent of the real problem here and can have any dimensions they choose. If you get a dimension mismatch, it means your code is doing something incorrect. The first thing to look for is to make sure you are not referencing any global variables or hard-coding any dimensions.

Also note that there are several different tests used here. You can examine the test logic by opening the file `w3_unittest.py`

, although they use some more sophisticated python there than we need in the main notebook. The point is there is one test where the dimension of W2 is 1 x 3, which means that the dimension of A1 needs to be 3 x m, which m is the number of samples. So if your code is producing the wrong shape for A1, then the question is how that could happen.

Thank you for the help, Paul!