# C1\_W3\_Assignment Assertion Error Help Please

**URL:** <https://community.deeplearning.ai/t/c1-w3-assignment-assertion-error-help-please/274538>\
**Category:** Linear Algebra for Machine Learning and Data Sc...\
**Tags:** week-module-3\
**Created:** [February 15, 2023, 12:02pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment-assertion-error-help-please/274538 "2023-02-15T12:02:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![James9](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@James9](https://community.deeplearning.ai/u/James9)\
**Post date:** [February 15, 2023, 12:02pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment-assertion-error-help-please/274538/1 "2023-02-15T12:02:27Z")

</div>

## Y\_hat 0.5173733862619162 n\_x 1 X.shape[1] 30

AssertionError Traceback (most recent call last)  
 in   
----\> 1 Y\_hat = forward\_propagation(X, parameters)  
2  
3 print(Y\_hat)

in forward\_propagation(X, parameters)  
36 print (“X.shape[1]”)  
37 print (X.shape[1])  
—\> 38 assert(Y\_hat.shape == (n\_x, X.shape[1]))  
39 return Y\_hat

The values if n\_x and X.shape[1] is ok, bit the assert function has an error

---

<div class="post-metadata">

**Author:** ![bs80](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bs80](https://community.deeplearning.ai/u/bs80)\
**Post date:** [February 15, 2023, 12:46pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment-assertion-error-help-please/274538/2 "2023-02-15T12:46:29Z")

</div>

If your n\_x of 1 and X.shape[1] of 30 are correct, then your Y\_hat needs to be of shape (1, 30). The Y\_hat value that you printed out looks like a scalar.

---

<div class="post-metadata">

**Author:** ![James9](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@James9](https://community.deeplearning.ai/u/James9)\
**Post date:** [February 15, 2023, 12:49pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment-assertion-error-help-please/274538/3 "2023-02-15T12:49:58Z")

</div>

I printed the Y\_hat value before the assert function.

---

<div class="post-metadata">

**Author:** ![James9](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@James9](https://community.deeplearning.ai/u/James9)\
**Post date:** [February 15, 2023, 12:52pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment-assertion-error-help-please/274538/4 "2023-02-15T12:52:33Z")

</div>

There seems to be no reason that the assert function should not work with :  
Y\_hat = 0.517…  
n\_x = 1  
X.shape[1] = 30

---

<div class="post-metadata">

**Author:** ![bs80](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bs80](https://community.deeplearning.ai/u/bs80)\
**Post date:** [February 15, 2023, 1:37pm UTC](https://community.deeplearning.ai/t/c1-w3-assignment-assertion-error-help-please/274538/5 "2023-02-15T13:37:17Z")

</div>

Your Y\_hat does not look like a 1×30 array.
