C2W3 Exercise 7 matrix size error

Getting a failure for matrices size. I check matrices W1, W2 and b1 and b2. My match the expected out size. Any help?

Working on it…

Two questions:

  • Does your initialize_parameters() function pass all its tests?
  • In nn_model(), when you call initialize_parameters(), are you passing the correct arguments and in the correct order?

Thank you for your time once again.
initialize_parameters() function passed all its tests and even passed the grader. It is exercise 3 in this lab.
Exercise 6 has us update the parameters which passed all tests and passed the grader.
In exercise 7, I used the updated parameters calculated in exercise 6. Now in exercise 7, I used the hints provided to in the exercise to select the parameters and order of the parameters.
The error for ex 7 tells me that the dimensions of W1, b1 and W2 are incorrect for 2 of the 5 tests. However, those are the same dimensions I used in all the other exercise. For instance, throughout the lab W1 is a 2X2, though it passed some of the tests in ex 7 it says expected 3X2 but got 2X2.
Even running Ex 7 gives the answer to W1 as a 2X2.

No that’s not the correct method. In Exercise 7, you should use the functions you developed earlier in the notebook.

The code you add to nn_model() are function calls to initialize_parameters(), forward_propagation(), compute_cost(), backward_propagation(), and update_parameters().

That’s the problem. The reason you’re getting dimension errors is because the data used in Exercise 7 is a different data set than was used in Exercises 3 though 6.

The purpose of those exercises is to create those general utility functions, so you can use them in Exercises 7 and 8.

1 Like

I was using the original parameters. As you suggested, I checked the initialize_parameters and used it with the correct parameters…it worked. I passed the course. Would not have been able to do it with your guidance. Thank you!

Thank you very much, I had exactly the same problem and your answer helped