Course 1 Week 4 Assignment 1 Exercise 9

I have error like this:
image

dA1, dW2, db2 are fine but the results of dA0, dW1, db1 are not correct. I try to count current cache by using “linear_activation_backward” in the loop with following arguments:
dAL, caches[l-1], activation=“relu” and then I take values dA_prev_temp, dW_temp, db_temp from current_cache. Anyone can help? I can’t find where is my mistake.

Hi @szymanel. dA0, dW1, and db1 are all computed in the same step of the for loop. Have a good look at the range of l, and at the Inputs of the for loop (in green italics in the exercise),
Regard Stephanus

Hi @sjfischer, thanks for reply. However I do not understand. Is caches[l-1] wrong in Your opinion? How would You change it?
I’ve tried with caches[l-2] and cache[l] in 2nd loop but did not work. I wrote it down and caches[l-1] seems to be the only option. Could You explain?

hi @szymanel reversed(range(L-1)) means the loop runs from L-1-1= L-2 to 0

In the first step of the loop, you need the cache for L-2, as you already have cache(L-1). what grads do you need?

HI @szymanel, Did you get an answer coz I am stuck here too.