C1 W2 Excercise 8

w, b = initialize_with_zeros(X_train.shape[0])…This code gives the correct output and also passes all the test cases.

While w, b = initialize_with_zeros(X_train.shape[1]) code gives ERROR: ValueError: shapes (1,7) and (4,7) not aligned: 7 (dim 1) != 4 (dim 0)

When printing X_train.shape[0] and X_train.shape[1] both shows 7 elements then why that error arises.
I am a bit confused, kindly help me.
Thank you

I think you must be doing the print incorrectly. You can print the shape as a “tuple” like this:


If you do that, you will see that the first and second elements are not the same.

Actually I bet I can guess what happened: after you changed the print statement, you probably just called the function again. That just runs the old code. You need to actually click “Shift-Enter” on the modified cell first to get the new code loaded into the runtime image. Then call the function.

Okay Sir. It was my mistake. Thankyou