Course5, Week1, Assignment2, Exercise3 - Problems in the clip function call

Hi! I’ve failed to overcome the following error just after the optimize function:

“AssertionError: Problems in the clip function call”

Up to this point everything seems fine, and even following the optimize_test, all expected values are achieved precisely. Could you please advise me a solution?

1 Like

If you look further at the code for the asserts, it says this:
assert np.min(grad) >= -5, “Problems in the clip function call”
assert np.max(grad) <= 5, “Problems in the clip function call”

The “grad” values come from the gradients returned by your optimize() function.

These asserts are thrown if your optimize() function gets bad results when it calls the clip() function.

Things to check:

  • is your optimize() function correctly calling your clip() function?
  • does your clip() function work correctly?