Thanks SJ. Somehow, I thought “vector_to_dictionary” as a recommendation, it’s actually a method imported from the gc_utils package. However, even after I made this change so that
J_plus[i], cache = forward_propagation_n(X, Y, vector_to_dictionary(theta_plus[i]))
Now, the error becomes:
ValueError: cannot reshape array of size 1 into shape (5,4)
The problem is you are passing only one element of theta_plus to the function. That is not what is intended. If that statement is not enough to get you there, try looking at the source code for vector_to_dictionary.
I fixed it, thanks! I thought I was supposed to make correction only to the code I wrote but, in this case, I had to make correction to the given code. Got it!
Great! Please note that they explained all that in the instructions. Here’s the relevant paragraph:
It seems that there were errors in the backward_propagation_n code! Good thing you’ve implemented the gradient check. Go back to backward_propagation and try to find/correct the errors (Hint: check dW2 and db1) .