Course 1 Week 4, Programming assignment #1

I am trying to solve Exercise 5 - L_model_forward, but facing the problem as

Error: Wrong output for variable 0.
Error: Wrong output for variable 0.
Error: Wrong output for variable 1.
Error: Wrong output for variable 0.
Error: Wrong output for variable 1.
2 Tests passed
1 Tests failed

It seems that AL value generated by my code doesnt match with the expected AL. I tried checking all possible execution path, re-running all the cells again, and code again, but not getting any clue for test case failure. Can someone please help me on how to solve this problem ?

Hello Rahul,

Can you share the screenshot of your output which mentions detail about the error you have encountered.

Also please confirm if your previous grader cell have passed as the expected output.

Regards
DP

There are some tricky differences between the first L-1 layers and the output layer.

  • In the first 1 through L layers, you need to use the trick you saw in initialize_parameters_deep() regarding the use of 'W' + str(...)' and 'b' + str(...) to get the correct references for W and b.

  • In the last layer, you need to use the correct parameter for the activations, and the layer index uses str(L).

There was a mistake in my code, where I had used sigmoid activation in hidden layers and ReLU activation in output layer. After using the correct activations in respective blocks, the issue is resolved.
Thank you for helping out.