Week 4 - Programming Assignment -1 - Exercise 9 - L_model_backward

You don’t show us the actual exception trace, so we can’t see the operands on the line that is “throwing”. That is the place to look. You’ve got a shape mismatch of some sort, so the first step is to understand what you think the shapes should be at that point in the code. Start by doing the “dimensional analysis” on the test case. Here’s a thread with an example of how to do that, but it is for the L_model_forward test. But apply the same ideas to this test case.

Also note that your previous line with the initialization of current_cache is wrong even once you get it indented correctly. caches is an array with one entry per layer, right? You need to select the entry for the current layer.