# C3W2\_Assignment: ValueError

**URL:** <https://community.deeplearning.ai/t/c3w2-assignment-valueerror/176294>\
**Category:** Natural Language Processing in TensorFlow\
**Tags:** week-module-3, week-module-4, week-module-2\
**Created:** [August 2, 2022, 2:18pm UTC](https://community.deeplearning.ai/t/c3w2-assignment-valueerror/176294 "2022-08-02T14:18:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Stallmann](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@Marco\_Stallmann](https://community.deeplearning.ai/u/Marco_Stallmann)\
**Post date:** [August 2, 2022, 2:18pm UTC](https://community.deeplearning.ai/t/c3w2-assignment-valueerror/176294/1 "2022-08-02T14:18:17Z")

</div>

With

[code removed - moderator]

I am getting:

ValueError: `logits` and `labels` must have the same shape, received ((None, 5) vs (None, 1)).

Whats wrong here?

[code removed - moderator]

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [August 3, 2022, 6:05am UTC](https://community.deeplearning.ai/t/c3w2-assignment-valueerror/176294/2 "2022-08-03T06:05:09Z")

</div>

Please fix the model loss function.

---

<div class="post-metadata">

**Author:** ![Kai\_Strasdas](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@Kai\_Strasdas](https://community.deeplearning.ai/u/Kai_Strasdas)\
**Post date:** [August 20, 2023, 10:45pm UTC](https://community.deeplearning.ai/t/c3w2-assignment-valueerror/176294/3 "2023-08-20T22:45:12Z")

</div>

I have the same problem:  
ValueError: `logits` and `labels` must have the same shape, received ((None, None, None, 1) vs (None,)).

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [August 21, 2023, 3:18am UTC](https://community.deeplearning.ai/t/c3w2-assignment-valueerror/176294/4 "2023-08-21T03:18:23Z")

</div>

Number of units in the output layer must equal the number of classes you’re trying to predict.

For this assignment, the output shape should be `(None, # classes)` where `None` refers to the batch size.
