in forward_propagation(X, parameters)
37 # YOUR CODE ENDS HERE
38
—> 39 assert(A2.shape == (1, X.shape[1]))
40
41 cache = {“Z1”: Z1,
I am getting this error, inspite of the shape of A2, being correct. I have gone through the matrix dimensions multiple times. Help me out with this.
lab id: bbotzymycckz
But the point of that error message is that the shape of A2 is not correct. So the next step would be to show us what the shape of your A2 value actually is.
I added this logic in the “print” if statement:
# Print the cost every 1000 iterations
if print_cost and i % 1000 == 0:
print ("Cost after iteration %i: %f" %(i, cost))
print(f"A2.shape {A2.shape}")
Sharing your code in a public thread is not allowed.
Regarding your error, as you say, you have passed all the above exercises. So, how you are initializing parameters for this exercise (Exercise 8 - nn_model )? You have to use initialize_parameters function.
Thank you for sharing your code, @Uddhav37. So, it is very important to understand what are n_x, n_h, and n_y and in what order they should pass to the initialize_parameters .