Not sure what I am doing wrong here wrong I am getting this error.
ValueError: shapes (1,147) and (2,3) not aligned: 147 (dim 1) != 2 (dim 0)
I defined my w,b as
w, b = initialize_with_zeros(X_train.shape[1]*X_train.shape[1]*3)
since
X_train – training set represented by a numpy array of shape (num_px * num_px * 3, m_train)
Thank you.
That is not correct. The point is that if the input is a 4D array, it must be “flattened” into a 2D matrix before you feed it to the model function. The number of “features” is the number of rows in the X sample matrix.
That’s what the comment you quote is telling you: the first dimension is num_px * num_px * 3, but that multiplication has already been done for you by the time X_train is passed to model.
1 Like
Hello thank you for your response,
Ok that makes sense the input array is flattened into a 2d already ok so it means I should do this.
w, b = initialize_with_zeros(X_train.shape[0])
But when I run the next line of code I get this.
ValueError: shapes (1,4) and (2,3) not aligned: 4 (dim 1) != 2 (dim 0)
1 Like
You must be referencing the wrong variable for the X in the second statement.
from public_tests import *
model_test(model)
Ok you were right I was using X instead of X_train and Y instead of Y_train!