Week 2: Optimization Methods Assignment - Exercise 6 Update Parameters with Adam

Hello,

I’ve been stuck on this problem for a couple of days could you please help me out. I can’t seem to find the issue. The answers are off by a very small number…

W1 = 
[[ 1.63949493 -0.62691477 -0.54326465]
 [-1.08769515  0.85031501 -2.28657079]]
W2 = 
[[ 0.33262355 -0.26414959  1.47708248]
 [-2.0457142  -0.30744639 -0.36898502]
 [ 1.14872646 -1.09849003 -0.15727519]]
b1 = 
[[ 1.7549895]
 [-0.7461017]]
b2 = 
[[-0.89102966]
 [ 0.02699863]
 [ 0.56780324]]
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-26-fb9df09bb7f1> in <module>
     13 print(f"b2 = \n{parameters['b2']}")
     14 
---> 15 update_parameters_with_adam_test(update_parameters_with_adam)

~/work/release/W2A1/public_tests.py in update_parameters_with_adam_test(target)
    257         assert type(parameters[key]) == np.ndarray, f"Wrong type for parameters['{key}']. Expected np.ndarray"
    258         assert parameters[key].shape == parametersi[key].shape, f"Wrong shape for  parameters['{key}']. The update must keep the dimensions of parameters inputs"
--> 259         assert np.allclose(parameters[key][0], expected_parameters[key]), f"Wrong values. Check you formulas for parameters['{key}']"
    260         #print(f"{key}: \n {str(parameters[key])}")
    261 

AssertionError: Wrong values. Check you formulas for parameters['W1']

Fixed by @ajpark07.

This was the cause of the error.

Good luck with the rest of the course :slight_smile: