W4 Ex 5 - L_model_forward

That means that your logic for handling the output layer is incorrect. The A_prev value that you are using as input is incorrect. Take a more careful look at the values that the variables contain when you fall out of the loop over the hidden layers.

Here’s another recent thread with exactly the same error message. Please read my post there for more info about how to debug this.