Just to give a higher level summary of the excellent advice from @kenb: it is a general principle of debugging that just because the error is thrown in a particular function, that does not mean that is where the actual bug is. Your linear_forward
routine is probably correct, since it passed the previous test cases. So the problem is that you passed incorrect (mismatching) values for A and W down to that routine. So where is the call site? How could things go wrong? Note that it always helps in a case like this to first do the “dimensional analysis”, so that you know what should be happening at each layer. Here’s a thread which covers that for the “2hidden” test case if that’s the one you are talking about (you don’t really say).
1 Like