Week3_backward_propagation_test_shapes_not_aligned

{moderator edit - solution code removed}

That is the code I have written for backward propagation. However, the backward_propagation_test() shows the following error.

ValueError: shapes (4,1) and (4,3) not aligned: 1 (dim 1) != 4 (dim 0)

Can someone help me solve the issue? Thanks.

Hi @Vignesh_Krish

One way to trace what the problem might be is to use a print statement to print the shape of each of the arguments pass to the function for the calculation.

Hi, Vignesh.

Your code looks correct to me, although please note that we aren’t supposed to publish that here or in any other public place. You can show us the exception trace, though. That is the best way to start the investigation. It may reveal a couple of lines of code, but that’s ok.

The key thing that the trace will show is exactly which operation it is that is throwing that shape mismatch error. From there, you can then track backwards to figure out where the error actually is by implementing Kin’s suggestion of printing the shapes.