Two_layer_model (week4 assignment 2)

after reviewing all existing discussions on this topic, I have ran out of ideas about what I might be doing wrong. at some point my cost after iteration 1 was actually close to 0.69 as expected but outputs were still wrong; I have since lost track of why I don’t get the same error messages.

I made sure all previous cells were ran.
sigmoid comes before relu.

what might the error be?

Cost after iteration 1: 0.8396276891856396
Cost after first iteration: 1.293099325833286
Cost after iteration 1: nan
Cost after iteration 1: nan
Cost after iteration 1: nan
Error: Wrong output for variable W1.
Error: Wrong output for variable b1.
Error: Wrong output for variable W2.
Error: Wrong output for variable b2.
Error: Wrong output for variable 0.
Cost after iteration 2: nan
Error: Wrong output for variable W1.
Error: Wrong output for variable b1.
Error: Wrong output for variable W2.
Error: Wrong output for variable b2.
Error: Wrong output for variable 0.
2 Tests passed
2 Tests failed

AssertionError Traceback (most recent call last)
in
3 print("Cost after first iteration: " + str(costs[0]))
4
----> 5 two_layer_model_test(two_layer_model)

~/work/release/W4A2/public_tests.py in two_layer_model_test(target)
75 ]
76
—> 77 multiple_test(test_cases, target)
78
79

~/work/release/W4A2/test_utils.py in multiple_test(test_cases, target)
140 print(’\033[92m’, success," Tests passed")
141 print(’\033[91m’, len(test_cases) - success, " Tests failed")
→ 142 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))
143

AssertionError: Not all tests were passed for two_layer_model. Check your equations and avoid using global variables inside the function.

The order of the activation functions is not the same for forward and backward propagation. If you put sigmoid before relu In both directions, one of them is incorrect. If everything else is correct, but you’re not able to match the cost after the first iteration, which one is wrong? HINT: where in the sequence is cost computed?