In the Week 3 graded lab, in the forward_propagation function, after the second END CODE HERE, there’s an assert that I believe is incorrect:
assert(Y_hat.shape == (n_x, X.shape[1]))
But Y_hat.shape should be (n_y,X.shape[1]). This is harmless for the single-variable part of the lab because n_x == n_y == 1. In the 2-variable section, though, I thought that bug would be exposed. It wasn’t: everything worked as expected. Finally I realized what’s going on: in the code for forward_propagation, n_x and n_y are not computed from the inputs; they are inherited from the environment when the function is compiled. The n_y inherited is 1 throughout the lab, and at the time forward_propagation is compiled, n_x = 1 also.
So I’m really identifying two bugs: the assertion should be Y_hat.shape == (n_y,X.shape[1]) and before the assertion, n_y should be computed from the inputs, say n_y, n_x = W.shape