I can’t complete the first course of the “Deep Learning Specialization” specialization because of an error (generated by an assert, Failed Graded) in the assignment “Deep Neural Network - Application - Programming Assignment•. Duration: 3 hours3h”(Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera)
I’m sure I wrote the required python instructions correctly, but I always get the same error that prevents me from passing the assignment.
How can I proceed?
You filed this under MLS, instead of DLS, so I will move it for you by using the little “edit pencil” on the title.
Are you sure that all the test cases in the notebook pass before you submit to the grader?
Also it would help if you could show us a screenshot of the actual error from the grader. Does it tell you what the assert message was?
this is the AutoGrader cell with assert error:
parameters, costs = two_layer_model(train_x, train_y, layers_dims = (n_x, n_h, n_y), num_iterations = 2, print_cost=False)
print("Cost after first iteration: " + str(costs[0]))
two_layer_model_test(two_layer_model)
OUTPUT:
Cost after first iteration: 0.693049735659989
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 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.
Expected output:
cost after iteration 1 must be around 0.69
I’m pretty sure that the code you showed looks correct (although we are not supposed to share that in public). Are you sure that you did not “hand import” any of the other routines from the “Step by Step” exercise?
Note that you aren’t supposed to actually use your functions from the previous assignment.
The “helper functions” used in Section 4 (“Exercise 1”) are imported from the “dnn_app_utils_v3.py” file that is provided with the assignment.
HI, I only wrote the code as asked, between the “### START CODE HERE ###” and “### END CODE HERE ###”
To close the loop on the public thread, all the added code was completely correct, but the problem was an accidental modification to part of the template code:
The “return” statement was accidentally indented so that it became part of the “for” loop over the iterations, so that it would never do more than one training iteration.