Week 2 model test error in propagate function

m​y propagate function executed well with same expected results ​however i got an error at model test function regarding to my propagate function I checked my code and run it several times with the same results

A perfectly correct function can still throw errors if you pass it incorrect parameters. It looks like you are referencing a global variable called X when you call optimize from model. That is not the correct variable to be passing on that call: you should pass in the actual variable that was declared for that parameter in the declaration of the model function. That’s why the shape does not match: the global variable you happen to be picking up has nothing to do with the test case being executed.

Also please do us a favor and edit your original post on this thread to remove the source code, once you get this figured out. It’s fine to post exception traces and the outputs of the tests, but we don’t want to leave the solution code sitting out there on the forums for everyone to see. Thanks!

thanks, i got it
I missed it several times, especially error didn’t point to it
appreciate your assistance

I’m glad to hear you found the solution. Thanks for confirming. Also thanks for removing the source code!

But if you say that the error “did not point to that”, please realize that debugging often involves more than one step. You start by looking at the error message. What does it mean? In this case, you can see that you have two variables w and X which have mismatching shapes. So the first question is: which one is wrong? Then you have to figure out how it got that way. That’s how debugging works. Nobody ever said it’s always easy or obvious, but it’s part of the job. :nerd_face:

1 Like