I am stuck in Exercise 8 of the programming assignment

Getting an error

in propagate(w, b, X, Y)
32 # YOUR CODE STARTS HERE
33
—> 34 A = sigmoid(np.dot (w.T , X) + b)
35
36 cost = (-1/m)* np.sum(Y*np.log(A) + (1-Y)*np.log(1-A) )

<array_function internals> in dot(*args, **kwargs)

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

Even though this function produced te correct output in the previous tests.

Maybe those other tests used a different size fro the variables w or X or b.
Your code must work with any set of data.
Check if you have perhaps hard-coded some values or sizes.

I did not use hard coded values…
Does the test in exercise 8 require reshaping the images in the training set?

I was setting the shape of w wrongly. Solved. Thank you!

1 Like