Guidance on L_layer_model function

This thread is about the second assignment in Week 4, but you are asking about the “Step by Step” assignment, which is the first one in Week 4.

In your case, you have fallen out of the “for” loop and you are doing the processing for the output layer, which uses the sigmoid activation. But what is happening is that the A_prev value there is not what you need it to be. In order to understand what is happening here, the best first step is to do the “dimensional analysis”. That will give you a clear picture of what should be happening at each layer. With that information, it will be more clear what the nature of your mistake is. Here’s a thread which walks you through that for this “2hidden” test case.

Please read that thread I linked and then see what that shows you. What shape should the A_prev value be at that point? Why did your value end up being wrong?