# Weird Error Assignment 1 question 3 - np sigmoid

**URL:** <https://dlai.staged-by-discourse.com/t/weird-error-assignment-1-question-3-np-sigmoid/53985>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [October 23, 2021, 10:22pm UTC](https://dlai.staged-by-discourse.com/t/weird-error-assignment-1-question-3-np-sigmoid/53985 "2021-10-23T22:22:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anna1](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@Anna1](https://dlai.staged-by-discourse.com/u/Anna1)\
**Post date:** [October 23, 2021, 10:22pm UTC](https://dlai.staged-by-discourse.com/t/weird-error-assignment-1-question-3-np-sigmoid/53985/1 "2021-10-23T22:22:16Z")

</div>

Hello! I am getting the following error for my bumpy sigmoid solution: AssertionError: Not all tests were passed for sigmoid. Check your equations and avoid using global variables inside the function.

I have consulted another answer to the same question, however I dud not make the same error as that asker. Can anyone please help me figure out what I did wrong?

# GRADED FUNCTION: sigmoid

def sigmoid(x):  
“”"  
Compute the sigmoid of x

```
Arguments:
x -- A scalar or numpy array of any size

Return:
s -- sigmoid(x)
"""

# (≈ 1 line of code)
# s = 
# YOUR CODE STARTS HERE

s = 1/(1 + np.exp(-x))

# YOUR CODE ENDS HERE

return s

```

Thank you!!

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlaistaging/user_avatar/dlai.staged-by-discourse.com/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://dlai.staged-by-discourse.com/u/paulinpaloalto)\
**Post date:** [October 23, 2021, 11:09pm UTC](https://dlai.staged-by-discourse.com/t/weird-error-assignment-1-question-3-np-sigmoid/53985/2 "2021-10-23T23:09:00Z")

</div>

I think your code looks correct. Are you sure that you actually reran the _sigmoid_ cell since the last code change you made? Just typing new code doesn’t do anything: you need to click “Shift-Enter” to execute the _sigmoid_ cell again to recompile your new code. Just calling the function again from the test cell runs the old code until you click “Shift-Enter” on the actual _sigmoid_ cell.

---

<div class="post-metadata">

**Author:** ![Anna1](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@Anna1](https://dlai.staged-by-discourse.com/u/Anna1)\
**Post date:** [October 24, 2021, 12:02am UTC](https://dlai.staged-by-discourse.com/t/weird-error-assignment-1-question-3-np-sigmoid/53985/3 "2021-10-24T00:02:11Z")

</div>

I didn’t realize I had to hit run on the cell with the instructions (the one that says exercise 3 and shows the vectors, for anyone who is also stuck.) Thank you very much (:

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlaistaging/user_avatar/dlai.staged-by-discourse.com/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://dlai.staged-by-discourse.com/u/paulinpaloalto)\
**Post date:** [October 24, 2021, 3:45pm UTC](https://dlai.staged-by-discourse.com/t/weird-error-assignment-1-question-3-np-sigmoid/53985/4 "2021-10-24T15:45:45Z")

</div>

This idea applies to any code cell you change: make sure to re-execute it after any change you make so that your change actually takes effect. Or you can make sure everything is consistent with what you are seeing by doing “Save”, then “Kernel → Restart and Clear Output” and then finally “Cell → Run All” or “Cell → Run All Above”.
