C2 W1 Assignment: Regularization Dropout Grading problem

A3 = [[0.49683389 0.05332327 0.04565099 0.01446893 0.49683389]]
1 Tests passed
1 Tests failed

AssertionError Traceback (most recent call last)
4 print ("A3 = " + str(A3))
----> 6 forward_propagation_with_dropout_test(forward_propagation_with_dropout)

~/work/release/W1A2/public_tests.py in forward_propagation_with_dropout_test(target)
166 ]
→ 168 multiple_test(test_cases, target)
170 def backward_propagation_with_dropout_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 forward_propagation_with_dropout. Check your equations and avoid using global variables inside the function.

I have checked my code multiple times. Please provide me a solution why I am still not able pass all my test case

You are using a global variable inside a function in the forward propagation with dropout grader cell.

Review the cell again and do the correction

Vayansh please delete the code from your public post. It is against community guidelines

Hello Vayansh,

Kindly refer to these instructions given before the forward_propagation with dropout grader cell. Notice while mentioning hint the expression is different than when recalled while as code.

Notice while recalling D1 or D2, this is the instruction given

Step 2: convert entries of D1 to 0 or 1 (using keep_prob as the threshold) but for that grader cell keep_prob is already defined with keep_prob=0.5, so are you converting data type here?

Also check to make sure you have not used a variable to recall a function


Thank you, ma’am, I found the error in my code by your guidance.

You are not suppose to convert for D1 or D2 by recalling it by .astype as the keep_prob is already defined for the cell.

you are only suppose to recall D1 and D2 with keep prob based on the hint instruction given without.astype(int)

Also when A to A*D you are shutting down some neurons. You are not suppose to use numpy.


That’s not the problem: the mistake was using the incorrect “random” function. That’s the most common error on this case: they explicitly tell you to use “rand” for the Uniform Distribution on (0,1), but people frequently use “randn” for the Gaussian Distribution. If you think about what the goal is here, it’s clear why that is a mistake.

1 Like

Thank you for correcting the reasoning Paul.