Help: My code is correct but it is not passing the tests - Course 2 Week 1

I am working on the Initialization graded assignment Exercise 2 - initialize_parameters_random. My code is not passing tests. I have already debugged it but still cannot manage to pass the test. Could someone please help me? Code and error message below:

{moderator edit - solution code removed}

Error message:

AssertionError Traceback (most recent call last)
in
4 print("W2 = " + str(parameters[“W2”]))
5 print("b2 = " + str(parameters[“b2”]))
----> 6 initialize_parameters_random_test(initialize_parameters_random)

~/work/release/W1A1/public_tests.py in initialize_parameters_random_test(target)
65 ]
66
—> 67 multiple_test(test_cases, target)
68
69 def initialize_parameters_he_test(target):

/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 initialize_parameters_random. Check your equations and avoid using global variables inside the function.

Hi @gugasparini ,

The problem is with your scaling value used in your code. Below is an extract from the implementation instruction:

Implement the following function to initialize your weights to large random values (scaled by *10) and your biases to zeros. Use np.random.randn(..,..) * 10 for weights and np.zeros((.., ..)) for biases. You’re using a fixed np.random.seed(..) to make sure your “random” weights match ours, so don’t worry if running your code several times always gives you the same initial values for the parameters.

1 Like

Thank you for your prompt response! It worked just fine! really appreciate it!