Week 2_Programming Assignment_Exercise 6

Hi everyone, I have some problems with exercise 6. When I perform propagate() function, I have passed all the test cases. But when I move to optimize() function, It throws the assertion error about the cost like this:

I have already checked the cost equation in the propagate() function and nothing wrong with it. Have anyone know about this issue?

Please provide your code in the optimize() function for investigation.

1 Like

Hi, @Nam_Nguyen_Xuan. Please do not share your code in the Discourse forum or any other public venue. It’s against the rules, as it can diminish the value to others that are struggling with the assignment, and thereby learning. You followed the proper procedure of posting the Traceback, and a brief discussion of the context in which the error has occurred. Thanks!

As a start, take a look at the AssertionError produced by the optimize_test() functon. Two things to note: 1) There should only be one cost reported, not two, and 2) the output should be a single element ndarray reporting the cost, not a regular Python float.

Please check that you have not “hard-coded” any arguments when you call the propagate() function within optimize(). That is, those arguments should be inherited from those in the call to optimize().