For starters, your AL value is 3 x 4, but the expected value for that is 1 x 4. The first step in a case like this is to do the “dimensional analysis” in order to understand what you should get at every level. Here is a thread which goes through that for the “2hidden” test case for L_model_forward. Please read that thread and then start examining what your code is actually producing at each layer and comparing it to the correct shapes.
1 Like