Hello, this is the first question I post. Thanks for your answers in advance.
I’m doing the DLS C1 W4 programming assignment and am having problems with the L_model_forward implementation. I haven’t had errors in the previous or later sections. However, when I run the validation tests, I recieve the correct output matrix AL but with shape and type errors. Below I show the output and the error output. It is weird because i have verified the W^[l], b^[l] and the cache shapes and none seem to show problems. At least they coincide with the L_model_forward_test(target) function in public_tests.py.
If someone could help me to figure out if this is a bug or how to fix the error, I would be very gratefull. Than you again in advance.
Expected output: AL = [[0.03921668 0.70498921 0.19734387 0.04728177]]
Output:
AL = [[0.03921668 0.70498921 0.19734387 0.04728177]]
Error: The function should return a numpy array. in variable 0. Got type: <class ‘numpy.ndarray’> but expected type <class ‘tuple’>
Error: The function should return a numpy array. in variable 1. Got type: <class ‘numpy.ndarray’> but expected type <class ‘tuple’>
Error: The function should return a numpy array. in variable 2. Got type: <class ‘numpy.ndarray’> but expected type <class ‘tuple’>
Error: Wrong shape for variable 0.
Error: Wrong shape for variable 1.
Error: Wrong shape for variable 2.
Error: Wrong shape for variable 1.
Error: Wrong shape for variable 0.
Error: Wrong shape for variable 1.
Error: Wrong shape for variable 2.
Error: Wrong shape for variable 1.
Error: Wrong shape for variable 0.
Error: Wrong shape for variable 1.
Error: Wrong shape for variable 2.
Error: Wrong shape for variable 1.
Error: Wrong output for variable 0.
Error: Wrong output for variable 1.
Error: Wrong output for variable 2.
Error: Wrong output for variable 1.
Error: Wrong output for variable 0.
Error: Wrong output for variable 1.
Error: Wrong output for variable 2.
Error: Wrong output for variable 1.
Error: Wrong output for variable 0.
Error: Wrong output for variable 1.
Error: Wrong output for variable 2.
Error: Wrong output for variable 1.
0 Tests passed
3 Tests failed
AssertionError Traceback (most recent call last)
in
4 print("AL = " + str(t_AL))
5
----> 6 L_model_forward_test(L_model_forward)
~/work/release/W4A1/public_tests.py in L_model_forward_test(target)
238 ]
239
→ 240 multiple_test(test_cases, target)
241 ‘’’ {
242 “name”:“datatype_check”,
~/work/release/W4A1/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 L_model_forward. Check your equations and avoid using global variables inside the function.