Exercise 8 of week 3

I totally followed the instructions but this error showed up in Exercise 8


. Please help me fix this. Thank you.

Hi @Kyle. The traceback is telling you that the problem lies in your forward_propagation function. Specifically, multiplying two matrices requires that the column dimension of the first matrix in the product, equals the row dimension in the second matrix.

You may recall from the videos that this is where many bugs occur. Even the instructor admits to having to carefully keep track of matrix dimensions. Me too! Try and go beyond merely following instructions and work out the matrix dimensions on your own. A little investment up front to help you out over the long run. :thinking: :smiley:

If you would, reply with your output from Exercise 4.

same here… But I can’t find any issue…

@Kyle @Riddhiman you are multiplying W1 and X, if their shapes are not properly aligned for matrix multiplication you should check what’s the shape of both X and W1 at several places.

Starting with nn_model, what’s the shape of X and the shape of W1? If one of them is wrong, where it is defined or calculated? If at that point both are correct, then follow the trace, where is the next place were both are used? What are their shapes?

If you follow this approach eventually you will find a place where their shapes are not correct i.e. they cannot be multiplied.