Unable to pass automatic grading for Question 2

Hi all,
I got this error after submitting the week 2 lab assignment. I’ve made various fixes but still getting the same error. Do you know how I can address this? Thanks.

Code Cell UNQ_C2: Function ‘compute_gradient’ is incorrect. Check implementation.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.

1 Like

It means your code for computing the gradients isn’t correct, when the grader uses its test cases.

For starters, does your code pass all of the tests in the notebook?

Yes, I’m getting all the answers correct, my results match the expected outputs.

That’s good, but it doesn’t prove your code is perfect. The notebook’s test cases are not comprehensive.

Thanks for the feedback, do you have other advice? I also referred to the hints provided, but that didn’t do the trick.

Check whether your code uses any global variables, or locally-defined constants that might not be provided by the grader.

Check whether you modified any of the code outside of the “YOUR CODE HERE” banners.
Changing the arguments in a function definition, or changing the return values, are common mistakes.

Students often get an error they don’t understand, and fix it in a way that makes it only work for one set of tests.

Last resort, save your notebook under a new name, then get a clean copy of the notebook and start over. You can copy your code to the new notebook, but be careful that you don’t modify parts of the notebook that you shouldn’t.

Overall, try looking at your code with great suspicion, and question everything it does.