C1_W3_Assignment Exercise 4

Hello, I don’t know understand the error code. Can anyone explain what this error code means.


NameError Traceback (most recent call last)
in
----> 1 Y_hat = forward_propagation(X, parameters)
2
3 print(Y_hat)

NameError: name ‘X’ is not defined

This error means that this parameter X in the arguments of the function is not previously defined.

Thank you. I have re-run the other codes in previous exercises to define X, but got this error code.


ValueError Traceback (most recent call last)
in
----> 1 Y_hat = forward_propagation(X, parameters)
2
3 print(Y_hat)

in forward_propagation(X, parameters)
20 # Implement Forward Propagation to calculate Z.
21 ### START CODE HERE ### (~ 2 lines of code)
—> 22 Z = np.matmul( X,W)+b
23 Y_hat = forward_propagation(X, parameters)
24 ### END CODE HERE ###

ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 1 is different from 30)

Alright, at this point I suggest you go back through the entire course because it seems to me you have not understood the basic principles. The error tells you those 2 matrices X, and W can not be multiplied, you should transpose one of them.

Also I advise you to take some classes (at least somewhere online) about python because some understanding of it is needed for the course.