Week # must be added in the tags option of the post.
Link to the classroom item you are referring to:
Description (include relevant info but please do not post solution code or your entire notebook)
Week 3, 4.7: Integration, Excercise 8: nn_model
Program Assignment: Planar data classification with one hidden layer
After completing the first six exercises with “All tests passed”, I ran Exercise 8: nn_model.
However, I got an error regarding the multiplication of matrices within the function “forward_propagation.”
The error says: ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 2 is different from 6)
I tested the multiplication in a new cell and it works. However, the function does not work.
Since all your previous tests pass, the bug is probably not in forward_propagation. It is that you are passing mismatching parameters when you call it from nn_model. So how could that happen? Look at the arguments you are passing. Are you sure you are sending the output of layer 1 as the input to layer 2, for example? One common error is to use X again as the input at layer 2, instead of A1. Also check that you are not referencing global variables instead of the parameters of the function.
Thank you for your prompt response and valuable insights.
The problem was with the size of the input layer (n_x). I was getting the right numerical answer but did not correspond to the right procedural solution.
I have fixed it now.
Regards.