/opt/conda/lib/python3.7/site-packages/dlai_tools/testing_utils.py in multiple_test(test_cases, target)
162 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
163 raise AssertionError(
→ 164 “Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))
AssertionError: Not all tests were passed for update_parameters_with_momentum. Check your equations and avoid using global variables inside the function.
You can go to the Files menu and open the “public_tests.py” file.
Then you can find the test cases for that function and perhaps figure out which one is failing.
/opt/conda/lib/python3.7/site-packages/dlai_tools/testing_utils.py in multiple_test(test_cases, target)
162 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
163 raise AssertionError(
→ 164 “Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))
AssertionError: Not all tests were passed for update_parameters_with_momentum. Check your equations and avoid using global variables inside the function.
Note that you shouldn’t put too much store in the fact that you passed 2 tests. If you looked at the tests, you’ll see that typically they first check the type of the output value, then the shape and only if the first two pass do they check the actual values. So you probably produced a numpy array of the correct dimensions, but the actual values are wrong.
So, as Tom says, the fact that the error is thrown in code you didn’t write doesn’t mean it’s not your problem. Now the question is figuring out where your code is incorrect. Most people have trouble in the Adam section, but that comes later. There the issue is typically “order of operations” on the \epsilon value.
For the Momentum logic, there are a lot fewer moving parts than in the Adam case. The first step would be to carefully compare your code to the math formulas. E.g. in the formula for u_{dW^{[l]}} there are two terms and they use different base values: the value multiplied by \beta is different than the one multiplied by (1 - \beta), right?
And continue that level of analysis through both the formulas …