W4 A2 Two_layer_model result don't understand

hi,
i got below result from my code, but don’t know what the error is, is it s type wrong or functions wrong?

Cost after iteration 1: nan
Cost after first iteration: 0.693049735659989
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.
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.
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.

These errors are telling you that you have something wrong inside the:
multiple_test(test_cases, target) function
and the,
two_layer_model_test(two_layer_model) function

You got to check again their implementation you must be doing something when writing up the code inside them.

Hey @Lucy_Hui,
As per your assertion error, you have used a global variable inside the function two_layer_model. Do check your implementation of this function again, for instance, you might have used train_x and train_y instead of X and Y inside the function. If this doesn’t help, feel free to reach out.

P.S. - Always mention the Week and Assignment number in the title of your post, so that it’s easy for both mentors and other learners to answer and learn from your query. I have modified the title for you by using the little pencil icon next to the title.

Regards,
Elemento

Note that using global variables is just one suggestion for what the error might be. The point is that you can assume the functions you are calling are correct, but there must be some mistake in how you are calling them from two_layer_model. You need to go over the instructions and the code carefully. Notice that you are getting NaN (not a number) values for the costs. Are you sure you are supplying the correct arguments when you call compute_cost?