Week 4_A2 Exercise 1

Hi am currently working on week 4 exercise 1 project involving implementing a two-layer neural network. While I’ve made significant progress in my implementation, I’ve encountered an error that has me stumped. I’m reaching out to the community for assistance and guidance in resolving this issue.

The specific error I’m facing is a “shapes not aligned” error during the forward propagation step of my two-layer neural network. The error message reads as follows:

As I understand it, this error pertains to a mismatch in the dimensions of matrices during a matrix multiplication operation within my linear_forward function. I have carefully reviewed my code However, despite my efforts, I haven’t been able to identify the root cause of this issue.

I am reaching out to the community to seek assistance in debugging this error. I believe that your expertise and insights could provide valuable guidance in resolving this challenge. If you’re available, I would greatly appreciate your input and suggestions.

The point of “forward propagation” is that the second layer takes the output of the first layer, right? That’s not what you implemented.

It’s also a general principle of debugging that just because the error is thrown in linear_forward, that doesn’t mean that is where the bug is. A perfectly correct function can still throw errors if you pass it incorrect (mismatching) arguments. But you have to start from the point of the error and then work your way backwards to figure out where the real mistake is.

Thanks very much, i will reimplement it again.