# Gradient Checking (W1A3) - Grader stuck at 60 % – local validation passes (please clear cache)

**URL:** <https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665>\
**Category:** Improving Deep Neural Networks: Hyperparameter tun\
**Tags:** week-module-1\
**Created:** [June 30, 2025, 1:02pm UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665 "2025-06-30T13:02:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottcable](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/scottcable/32/113912_2.png) [@scottcable](https://community.deeplearning.ai/u/scottcable)\
**Post date:** [June 30, 2025, 1:02pm UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/1 "2025-06-30T13:02:12Z")

</div>

Hi mentors,

I think the autograder is using an old cached copy of my notebook.  
Here are the details you might need:

Course: Deep Learning Specialization, Course 1, Week 1  
Assignment: Gradient Checking (W1A3)  
Latest submission time shown on Coursera: 30 Jun 2025, 12:54 BST  
SHA-1 of the notebook currently in /submitted/courseraLearner/W1A3:  
c0e360ebf02c74267a394a8b5d06191031f1d5b6  
Local validation result:  
`nbgrader validate /submitted/courseraLearner/W1A3/Gradient_Checking.ipynb`  
→ **Success! Your notebook passes all the tests.**  
UTC time when I calculated the SHA-1: Mon 30 Jun 2025 12:54:47 UTC

Even though the notebook validates locally, the Coursera grader still  
returns “Tests failed on 1 cell(s)” and a score of 60 %.

Could you please clear the grader cache (or re-queue) for my latest  
submission so it re-evaluates the notebook with the SHA-1 above?  
I’m confident it will pass the hidden tests once the cache is refreshed.

Thank you very much!

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [June 30, 2025, 4:32pm UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/2 "2025-06-30T16:32:00Z")

</div>

We cannot manipulate your environment or even look directly at your notebooks. My guess is that the grader uses a different test case than the ones in the notebook. So if you pass one test, but fail a different test, the thing to look for is ways in which your code is not general: you have done something that makes the code specific to the particular test case. Referencing global variables instead of the formal parameters of the function or hard-coding dimensions are typical ways of introducing that type of problem.

If that’s not enough of a hint, we aren’t allowed to share code on a public thread, but there are private ways to do that. Please check your DMs for a message from me.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [June 30, 2025, 11:53pm UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/5 "2025-06-30T23:53:31Z")

</div>

To close the loop on the public thread, the problem is that the grader is checking the type of the difference value, but the tests in the notebook don’t care. If you cast the final difference value to type `float`, you fail the grader, even if the value is actually correct. The solution is simple: just don’t do any casts on the value and you end up with `numpy.float64` and the grader is pleased.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [July 1, 2025, 12:11am UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/6 "2025-07-01T00:11:31Z")

</div>

Wow. That’s entirely not helpful behavior by the grader.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [July 1, 2025, 12:30am UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/7 "2025-07-01T00:30:05Z")

</div>

Indeed. Compounded by the fact that it can’t be bothered to even tell us which function failed the test, let alone the specific thing it was not happy with about the output.

 ![Screenshot 2025-06-30 at 5.27.48 PM](https://global.discourse-cdn.com/dlai/original/3X/c/8/c8fbe542196f405e31b8251eb9a1edec344471f3.jpeg)

I’ll consider filing a bug about this, although in the past they have frequently been hesitant to modify the grader logic.

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [July 1, 2025, 1:30am UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/8 "2025-07-01T01:30:16Z")

</div>

Actually it would be worth filing a bug. Even if it’s too scary to change the grader, there’s a workaround: add a test in the notebook that asserts the type is whatever the grader will accept for that value. We know that `numpy.float64` works, but perhaps there are others that will also work. Sure it would be a bit of a hack, but better than leaving us with no alternative but to look at the code to figure out what is wrong.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [July 1, 2025, 1:39am UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/9 "2025-07-01T01:39:11Z")

</div>

I think it best to add tests to the notebook, so that the grading process doesn’t add its own undocumented requirements.

---

<div class="post-metadata">

**Author:** ![scottcable](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/scottcable/32/113912_2.png) [@scottcable](https://community.deeplearning.ai/u/scottcable)\
**Post date:** [July 1, 2025, 6:39am UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/10 "2025-07-01T06:39:56Z")

</div>

Thanks both, submitted now with 100%

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [July 1, 2025, 6:20pm UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/11 "2025-07-01T18:20:17Z")

</div>

Just filed a bug suggesting that they add this additional assertion in the test cell for `gradient_check_n`:

`assert type(difference) == np.float64, "The value must be a 64 bit floating point scalar."`

BTW I confirmed that the grader also fails if you cast the type to `numpy.float32`, so the grader’s check must be equivalent to that assertion.

---

<div class="post-metadata">

**Author:** ![ValG1](https://avatars.discourse-cdn.com/v4/letter/v/d78d45/32.png) [@ValG1](https://community.deeplearning.ai/u/ValG1)\
**Post date:** [July 28, 2025, 3:05pm UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/12 "2025-07-28T15:05:54Z")

</div>

I had the same issue and adding converting `difference` using `np.float64()` indeed solved the issue. If I may make a suggestion: maybe a hint could be included into the instructions of the notebook. If the grader’s logic can’t be changed, then I think it would save a lot of time and frustration on the students’ side to just tell them to make sure the returned value `difference` is type `numpy.float64`. In any case, was grateful to find help here, thank you!

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [July 28, 2025, 4:18pm UTC](https://community.deeplearning.ai/t/gradient-checking-w1a3-grader-stuck-at-60-local-validation-passes-please-clear-cache/842665/13 "2025-07-28T16:18:32Z")

</div>

Hi, Valentina.

Yes, as I mentioned in the discussions earlier on this thread, I’ve already filed an enhancement request to add an assertion in the notebook that detects and prevents this error. Sorry, but they haven’t gotten to implementing that yet (filed within the last two weeks).

Regards,  
Paul
