# C1\_W3\_assignment

**URL:** <https://community.deeplearning.ai/t/c1-w3-assignment/266461>\
**Category:** Supervised ML: Regression and Classification\
**Tags:** week-module-3\
**Created:** [February 1, 2023, 9:12am UTC](https://community.deeplearning.ai/t/c1-w3-assignment/266461 "2023-02-01T09:12:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandor\_Vas](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Sandor\_Vas](https://community.deeplearning.ai/u/Sandor_Vas)\
**Post date:** [February 1, 2023, 9:12am UTC](https://community.deeplearning.ai/t/c1-w3-assignment/266461/1 "2023-02-01T09:12:06Z")

</div>

{moderator edit; code removed}

Y\_hat = forward\_propagation(X, parameters)

print(Y\_hat)

[[-0.00493387 0.01659322 -0.01338333 0.00266656 -0.01770289 -0.00777096  
0.03559277 0.0105737 0.00593931 0.01357588 0.03185961 0.01702083  
0.01700957 -0.01753349 -0.02698312 0.00190047 0.01447146 -0.02512013  
-0.02261117 -0.0139429 0.01177189 -0.00820183 0.00816806 0.00414283  
-0.00901311 -0.00065283 -0.01393153 0.00385646 0.00946067 0.00498611]]

w3\_unittest.test\_forward\_propagation(forward\_propagation) error

ValueError Traceback (most recent call last)  
 in   
----\> 1 w3\_unittest.test\_forward\_propagation(forward\_propagation)

~/work/w3\_unittest.py in test\_forward\_propagation(target\_forward\_propagation)  
286  
287 for test\_case in test\_cases:  
 → 288 result = target\_forward\_propagation(test\_case[“input”][“X”], test\_case[“input”][“parameters”])  
289  
290 try:

in forward\_propagation(X, parameters)  
19 # Implement Forward Propagation to calculate Z.  
20 ### START CODE HERE ### (~ 2 lines of code)  
—\> 21 Z = np.add(np.matmul(W,X), b)  
22 Y\_hat = Z  
23 ### END CODE HERE ###

ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)-\>(n?,m?) (size 2 is different from 1)

What should I do to resolve it?

---

<div class="post-metadata">

**Author:** ![Girijesh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/girijesh/32/37283_2.png) [@Girijesh](https://community.deeplearning.ai/u/Girijesh)\
**Post date:** [February 1, 2023, 12:58pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment/266461/2 "2023-02-01T12:58:32Z")

</div>

Hi @Sandor_Vas,

Welcome to the community.

try  
Z = np.dot(W,X) + b  
for Y\_hat, you have not applied the activation function  
like  
Y\_hat = some\_activation\_function(Z)

---

<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:** [February 1, 2023, 6:44pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment/266461/3 "2023-02-01T18:44:59Z")

</div>

Please do not post your code on the forum. That isn’t allowed by the community standards.

I have edited your message to remove the code.

---

<div class="post-metadata">

**Author:** ![Sandor\_Vas](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Sandor\_Vas](https://community.deeplearning.ai/u/Sandor_Vas)\
**Post date:** [February 2, 2023, 4:47pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment/266461/4 "2023-02-02T16:47:29Z")

</div>

I understood. Thanks.

---

<div class="post-metadata">

**Author:** ![Sandor\_Vas](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Sandor\_Vas](https://community.deeplearning.ai/u/Sandor_Vas)\
**Post date:** [February 2, 2023, 4:52pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment/266461/5 "2023-02-02T16:52:45Z")

</div>

Hi @Girijesh, Thank you for your help.

---

<div class="post-metadata">

**Author:** ![Sandor\_Vas](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@Sandor\_Vas](https://community.deeplearning.ai/u/Sandor_Vas)\
**Post date:** [February 4, 2023, 8:52am UTC](https://community.deeplearning.ai/t/c1-w3-assignment/266461/6 "2023-02-04T08:52:38Z")

</div>

After execution  
w3----------unittest.test--------------forward-propagation------------------- (forward\_propagation)

I have the following message:

“Test case “default\_check”. Wrong array A.” Ok, but what can I do with it? I haven’t got array A. Of course the test failed. I hope I did not violate the code rules

Exercise 4

1. Implement Forward Propagation. Compute `Z` multiplying arrays `w`, `X` and adding vector `b`. Set the prediction array 𝐴 equal to 𝑍.  
------------------------^^
