Week 3, programming assigment, exercise 7

Hello I have this implementation and surprisingly in the test W1 is OK but db1 is wrong.

{moderator edit - solution code removed}

and then this is the error

W1 = [[-0.00643025 0.01936718]
[-0.02410458 0.03978052]
[-0.01653973 -0.02096177]
[ 0.01046864 -0.05990141]]
b1 = [[ 1.79504691e-07]
[-1.63112418e-06]
[-1.20962127e-07]
[ 5.09121400e-07]]
W2 = [[-0.01041081 -0.04463285 0.01758031 0.04747113]]
b2 = [[-1.82990876e-05]]

AssertionError Traceback (most recent call last)
in
7 print("b2 = " + str(parameters[“b2”]))
8
----> 9 update_parameters_test(update_parameters)

~/work/release/W3A1/public_tests.py in update_parameters_test(target)
238
239 assert np.allclose(output[“W1”], expected_output[“W1”]), “Wrong values for W1”
→ 240 assert np.allclose(output[“b1”], expected_output[“b1”]), “Wrong values for b1”
241 assert np.allclose(output[“W2”], expected_output[“W2”]), “Wrong values for W2”
242 assert np.allclose(output[“b2”], expected_output[“b2”]), “Wrong values for b2”

AssertionError: Wrong values for b1

Please any help would be very much appreciated…

The lines that update b1 and b2 are obviously wrong. Look again more closely. Notice how the b lines are different than the ones for W1 and W2?

Also note that it is a waste of energy to do deepcopys of the gradient values. You’re not modifying the gradients here, right? That’s the point of the deepcopy: to break the object reference to an object that you are going to modify.

Here’s a thread which explains that comment about the deepcopys.

solved!! very much thank you!!!