Excercise 9 - L-Model Backward¶

Hello,
I’m getting the following error on Excercise 9 L-Model Backward

ValueError: not enough values to unpack (expected 3, got 2)

Appreciate your help

Hi @Manuel_Trujillo

Could you post the full error traceback for diagnosis.

Thanks Kic,
See below

ValueError                                Traceback (most recent call last)
<ipython-input-31-3ace16762626> in <module>
      1 t_AL, t_Y_assess, t_caches = L_model_backward_test_case()
----> 2 grads = L_model_backward(t_AL, t_Y_assess, t_caches)
      3 
      4 print("dA0 = " + str(grads['dA0']))
      5 print("dA1 = " + str(grads['dA1']))

<ipython-input-30-3b81661dfdb7> in L_model_backward(AL, Y, caches)
     42 
     43     current_cache = caches[L-1]
---> 44     dA_prev_temp, dW_temp, db_temp = linear_backward(dAL, current_cache)
     45     grads["dA" + str(L-1)] = dA_prev_temp
     46     grads["dW" + str(L)] = dW_temp

<ipython-input-14-3957bbf871d1> in linear_backward(dZ, cache)
     14     db -- Gradient of the cost with respect to b (current layer l), same shape as b
     15     """
---> 16     A_prev, W, b = cache
     17     m = A_prev.shape[1]
     18 

ValueError: not enough values to unpack (expected 3, got 2)

The problem is that you are calling linear_backward directly from L_model_backward. Please have another look at the instructions. linear_backward should be called from linear_activation_backward, right?

Got it
It’s working

Thanks Paul