# C3\_W2\_RecSysNN\_Assignment Auto-grader Error 'd' not defined

**URL:** <https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499>\
**Category:** Unsupervised Learning, Recommenders, Reinforcement\
**Tags:** week-module-3\
**Created:** [July 6, 2023, 8:00pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499 "2023-07-06T20:00:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmsok\_hbu](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Ahmsok\_hbu](https://community.deeplearning.ai/u/Ahmsok_hbu)\
**Post date:** [July 6, 2023, 8:00pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/1 "2023-07-06T20:00:01Z")

</div>

I am recieving the following auto-grader error:  
"  
Code Cell UNQ\_C1: The value of your variable ‘user\_NN’ is correct.  
Code Cell UNQ\_C1: The value of your variable ‘item\_NN’ is correct.  
Code Cell UNQ\_C2: Unexpected error (NameError(“name ‘d’ is not defined”)) occurred during function check. We expected function `sq_dist` to return type \<class ‘bool’\>. Please check that this function is defined properly.  
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.  
"

The only place in the code where ‘d’ is used is here is in the sq\_dist function that is pre-defined by the lab notebook.

Additional information:

1. The autosave function of the notebook does not work
2. The notebook is showing an error from the time I first opened it

 ![image](https://global.discourse-cdn.com/dlai/original/3X/d/7/d75e2b117ac504c3706e330dc5a85c63eeadcb47.png)

Remarks about the Auto-grader output:

- Why is there an error indicating that it expects the sq\_dist function to return a boolean data type? This should be a float type.

---

<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 6, 2023, 9:32pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/2 "2023-07-06T21:32:13Z")

</div>

First, please verify whether you have ever re-named the notebook file.

Have you duplicated, copied, or moved any of the code cells in the notebook?

---

<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 6, 2023, 9:44pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/3 "2023-07-06T21:44:57Z")

</div>

Updates:  
I tested the code you posted for sq\_dist(). It works fine and does not throw any errors. So that’s not the cause of the grader error.

Please don’t post your code on the forum… That’s not allowed by the Code of Conduct.

I won’t be able to look at the grader’s test cases until later this evening, so I don’t have anything to say about the boolean data type.

---

<div class="post-metadata">

**Author:** ![Ahmsok\_hbu](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Ahmsok\_hbu](https://community.deeplearning.ai/u/Ahmsok_hbu)\
**Post date:** [July 7, 2023, 4:42pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/4 "2023-07-07T16:42:27Z")

</div>

I have not, that I am aware of. How do I re-set it so I start from scratch?

---

<div class="post-metadata">

**Author:** ![Ahmsok\_hbu](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Ahmsok\_hbu](https://community.deeplearning.ai/u/Ahmsok_hbu)\
**Post date:** [July 7, 2023, 4:44pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/5 "2023-07-07T16:44:02Z")

</div>

I have removed my code snippet.

---

<div class="post-metadata">

**Author:** ![Mujassim\_Jamal](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mujassim_jamal/32/53828_2.png) [@Mujassim\_Jamal](https://community.deeplearning.ai/u/Mujassim_Jamal)\
**Post date:** [July 7, 2023, 5:13pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/6 "2023-07-07T17:13:20Z")

</div>

Check [this](https://community.deeplearning.ai/t/how-to-get-a-clean-copy-of-an-assignment-notebook/73) out.

---

<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 11, 2023, 5:55am UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/7 "2023-07-11T05:55:58Z")

</div>

Note: I am unable to explain this error message.

> [@Ahmsok\_hbu](#):
>
> We expected function `sq_dist` to return type \<class ‘bool’\>

---

<div class="post-metadata">

**Author:** ![Rich\_Kline](https://avatars.discourse-cdn.com/v4/letter/r/96bed5/32.png) [@Rich\_Kline](https://community.deeplearning.ai/u/Rich_Kline)\
**Post date:** [July 17, 2023, 8:38pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/8 "2023-07-17T20:38:10Z")

</div>

All my code has passed the tests but I get this error when trying to submit my assignment: Cell #9. Can’t compile the student’s code. Error: TypeError(“unsupported operand type(s) for \*: ‘float’ and ‘module’”)What could this error mean? I see it in the code, but it was code that was pre generated for the assignment.

---

<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 18, 2023, 4:36am UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/9 "2023-07-18T04:36:00Z")

</div>

Are you using the Coursera Labs environment, or are you using some other platform?

This is a puzzling issue, because in that assignment (notebook name “C3\_W2\_RecSysNN\_Assignment.ipynb”), there is no user-provided code in the first nine cells. So the grader should not complain, unless you have modified something you ought to have left alone.

---

<div class="post-metadata">

**Author:** ![Sengu](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sengu](https://community.deeplearning.ai/u/Sengu)\
**Post date:** [January 17, 2025, 1:10pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/10 "2025-01-17T13:10:09Z")

</div>

Hello , I don’t find Model definition but referring in many many places in C3\_W2\_RecSysNN\_Assignment.ipynb. Do we need to create the model or Am I missing anything?

---

<div class="post-metadata">

**Author:** ![Sengu](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sengu](https://community.deeplearning.ai/u/Sengu)\
**Post date:** [January 17, 2025, 1:11pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/11 "2025-01-17T13:11:03Z")

</div>

@TMosh Can you please respond to this ?

---

<div class="post-metadata">

**Author:** ![Sengu](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sengu](https://community.deeplearning.ai/u/Sengu)\
**Post date:** [January 17, 2025, 1:17pm UTC](https://community.deeplearning.ai/t/c3-w2-recsysnn-assignment-auto-grader-error-d-not-defined/376499/12 "2025-01-17T13:17:20Z")

</div>

I have changed the code with model = tf.keras.Model([input\_user, input\_item], output). Now I am getting thanks.
