Course 1 Week 2 Asg 1 Ex 8_ model

Although I passed the Assignment , there remains an error in model and I would like to close the Course1 with all the assignments fully solved. So I tried to find the error but I did not succeed.

It seems that the init call for “w” is the culprit but I tried X_train.shape[0] and I got the error 1: A mismatch with X, because X has a different shape. But we have called “model” with X_train, where does this X come from?
X_train_shape is (4,7) but
X_shape is (2,3) Probably I missed a X = X_train. But where?

Then I tried init with X.shape[0], and logically got the error 2: impossible reshape of a size 2 into a (12288,1).
I made a error that I cannot see. Can you help me to solve it?.

Error 1:

Error 2:

It is a bug to reference global variables like X from the body of your model function. The local variable is X_train. We are writing general code here, so we need to make sure that functions are self-contained: they should only reference variables defined in the local scope of the function, which includes the formal parameters to the function.

Hi @Paul

Finally I solved the exercise. Thanks for giving me the hint to clarify my mind.

Rgds.
Joan Parés

Missatge de Paul Mielke via DeepLearning.AI <dlai@discoursemail.com> del dia ds., 16 d’oct. 2021 a les 3:15:

That’s good news! Onward! :nerd_face: