Note that passing a test in the notebook does not prove your code is perfect.
In backward_propagation(), there is a problem with the shape of either A2 or Y.
Could be the problem is in nn_model() where you compute A2.
After one day of debug, I’ve found that I wrote A2, “chache = forward_propagation” instead of “A2, cache = forward_propagation”… in function “nn_model”
So, in the next line my code used the value of the global variable cache defined in a previous exercise.
Now exercise 8 works properly.
Re-using function parameter names as global variables (i.e. using “cache” in more than one execution scope within the notebook) is not a great design for the assignment.