# Week2 initializing parameter

**URL:** <https://community.deeplearning.ai/t/week2-initializing-parameter/440018>\
**Category:** Neural Networks and Deep Learning\
**Tags:** coursera-platform\
**Created:** [September 8, 2023, 11:18am UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018 "2023-09-08T11:18:31Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 11:18am UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/1 "2023-09-08T11:18:31Z")

</div>

while initializing parameters I get error -  
w,b = initialize\_with\_zeroes(dim)  
data type not understood.

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [September 8, 2023, 11:33am UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/2 "2023-09-08T11:33:17Z")

</div>

Please share full error.

---

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 12:01pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/3 "2023-09-08T12:01:04Z")

</div>

i initialised parameter w with zeroes using numpy.zeros, setting dimension dim,1 ;  
and d to 0.  
I got above error… pls resolve

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [September 8, 2023, 12:08pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/4 "2023-09-08T12:08:30Z")

</div>

Devansh,

Saif is asking you if you can take a screenshot of the error you have encountered after you have run the cell. So further guidance can be given.

Regards  
DP

---

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 12:39pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/5 "2023-09-08T12:39:42Z")

</div>

oh yes!my bad sir!  
here is the attached screenshot of the error

 ![Screenshot (1341)](https://global.discourse-cdn.com/dlai/original/3X/d/6/d68c26a2e2d72dc8512ece85d36c2571a5ab746e.png)

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [September 8, 2023, 12:50pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/6 "2023-09-08T12:50:18Z")

</div>

devansh

do you see an assertion statement in the grader cell?

what w parameter is missing in your code line in relation to the assertion statement for w?

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [September 8, 2023, 12:58pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/7 "2023-09-08T12:58:55Z")

</div>

I suggest reading [this np.zeros](https://numpy.org/doc/stable/reference/generated/numpy.zeros.html) documentation. You should check example 3 given in that link and below:

```auto
>>> np.zeros((2, 1))
array([[0.],
       [0.]])

```

---

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 2:46pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/8 "2023-09-08T14:46:05Z")

</div>

sir i tried this its giving assertion error

---

<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:** [September 8, 2023, 2:58pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/9 "2023-09-08T14:58:09Z")

</div>

Please check the parentheses a bit more carefully. You can’t be sloppy about that kind of thing in programming: every character matters and you have to understand the syntax that is required. Did you follow Saif’s advice and actually read the documentation for `np.zeros`?

---

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 4:29pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/10 "2023-09-08T16:29:39Z")

</div>

sir i did read it!

---

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 4:32pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/11 "2023-09-08T16:32:12Z")

</div>

sir this is the error i am facing

 ![Screenshot (1342)](https://global.discourse-cdn.com/dlai/original/3X/8/a/8a9cbf9f630e853a67e5cac6cf44df62b117152f.png)

---

<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:** [September 8, 2023, 4:40pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/12 "2023-09-08T16:40:48Z")

</div>

Great! So you fixed the `np.zeros` call and now you’re on to the next problem. The assertion is telling you that b needs to be a scalar floating point value. But you set it to 0, right? That is an integer in python. So how would you make that a floating point value instead? Hint: in python 2 and 2. are not the same thing. 🤓

Or if you didn’t have this hint, then the way to debug this would be to print the type of your b value:

`print(type(b))`

If you do that, what do you see? Why is it not “float”?

Debugging is part of the job here. You wrote the code, but it doesn’t work. Now you need to figure out why. The assertion is telling you that the type is not “float”, so your first question is “Ok, then what type is it?” Then the next question is “How do I fix that to make it be a float?”

---

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 4:48pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/13 "2023-09-08T16:48:21Z")

</div>

do i need to write float(b) in assertion cell sir?!

---

<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:** [September 8, 2023, 4:50pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/14 "2023-09-08T16:50:22Z")

</div>

You can’t change the assertion cell. You need to change your code. Did you read what I said? There’s a hint there.

Try your solution and see what happens. Does that fix the problem?

Note that as is frequently the case in programming, there is more than one way to fix this problem. Any of them will do.

---

<div class="post-metadata">

**Author:** ![DEVANSH\_RAJ](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@DEVANSH\_RAJ](https://community.deeplearning.ai/u/DEVANSH_RAJ)\
**Post date:** [September 8, 2023, 5:30pm UTC](https://community.deeplearning.ai/t/week2-initializing-parameter/440018/15 "2023-09-08T17:30:48Z")

</div>

So I changed my code to 0.0 the code ran successfully.  
thankyou @paulinpaloalto @saifkhanengr @Deepti_Prasad for all your help.
