This looks like an error in the function test. I’m not setting the contents of the cache but the test fails to extract the required number of values in linear_backward. Despite linear_backward passing the test when it was coded.
t_dAL, t_linear_activation_cache = linear_activation_backward_test_case()
t_dA_prev, t_dW, t_db = linear_activation_backward(t_dAL, t_linear_activation_cache, activation = “sigmoid”)
print("With sigmoid: dA_prev = " + str(t_dA_prev))
print("With sigmoid: dW = " + str(t_dW))
print("With sigmoid: db = " + str(t_db))
t_dA_prev, t_dW, t_db = linear_activation_backward(t_dAL, t_linear_activation_cache, activation = “relu”)
print("With relu: dA_prev = " + str(t_dA_prev))
print("With relu: dW = " + str(t_dW))
print("With relu: db = " + str(t_db))
linear_activation_backward_test(linear_activation_backward)
…
ValueError Traceback (most recent call last)
in
1 t_dAL, t_linear_activation_cache = linear_activation_backward_test_case()
2
----> 3 t_dA_prev, t_dW, t_db = linear_activation_backward(t_dAL, t_linear_activation_cache, activation = “sigmoid”)
4 print("With sigmoid: dA_prev = " + str(t_dA_prev))
5 print("With sigmoid: dW = " + str(t_dW))
in linear_activation_backward(dA, cache, activation)
35
36 dZ = sigmoid_backward(dA, activation_cache)
—> 37 dA_prev, dW, db = linear_backward(dZ, cache)
38
39 # YOUR CODE ENDS HERE
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)