# Facing issues in C3W2\_Assignment

**URL:** <https://community.deeplearning.ai/t/facing-issues-in-c3w2-assignment/686125>\
**Category:** NLP with Sequence Models\
**Tags:** week-module-3\
**Created:** [September 1, 2024, 7:21am UTC](https://community.deeplearning.ai/t/facing-issues-in-c3w2-assignment/686125 "2024-09-01T07:21:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paramaguru](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@paramaguru](https://community.deeplearning.ai/u/paramaguru)\
**Post date:** [September 1, 2024, 7:21am UTC](https://community.deeplearning.ai/t/facing-issues-in-c3w2-assignment/686125/1 "2024-09-01T07:21:43Z")

</div>

In Named Entity Recognition : C3W2\_Assignment .

In “4.4 - Training the Model” section, I faced some error when model.fit is called. This function is calling " masked\_accuracy(y\_true, y\_pred) " function internally.

When I printed the y\_true and y\_pred values inside masked\_accuracy function, I got below.

y\_true : Tensor(“Cast\_3:0”, shape=(None, 104), dtype=float32) \<class ‘tensorflow.python.framework.ops.Tensor’\>  
y\_pred : Tensor(“sequential/dense\_7/LogSoftmax:0”, shape=(None, 104, 17), dtype=float32) \<class ‘tensorflow.python.framework.ops.Tensor’\>

I was expecting a list , numpy ndarray or a tensor of int/float values. But I received as above.

Note: I got all the test cases passed in “w2\_unittest.test\_masked\_accuracy(masked\_accuracy)”

can you please help me in this ? what exactly i am missing ?

---

<div class="post-metadata">

**Author:** ![Alireza\_Saei](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/alireza_saei/32/85175_2.png) [@Alireza\_Saei](https://community.deeplearning.ai/u/Alireza_Saei)\
**Post date:** [September 1, 2024, 8:35pm UTC](https://community.deeplearning.ai/t/facing-issues-in-c3w2-assignment/686125/2 "2024-09-01T20:35:41Z")

</div>

Hi @paramaguru

Here `y_true` and `y_pred` are symbolic Tensors, not actual values. This is expected behavior, as the actual data only flows through these Tensors during training. Your function passes unit tests, so that means `masked_accuracy` is correct. If you need to inspect values for debugging, use `tf.print` to print them during execution or make sure you’re in eager mode, where Tensors hold real data.

Hope it helps! Feel free to ask of you need further assistance.

---

<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 1, 2024, 8:41pm UTC](https://community.deeplearning.ai/t/facing-issues-in-c3w2-assignment/686125/3 "2024-09-01T20:41:54Z")

</div>

hi @paramaguru

issue is not only about tf data type, but if you notice your y\_true and y\_pred shape don’t match.

So as first debug step check if you used the correct recall for y\_pred.

See if the below pinned comment helps you debug.

> [@C3W2 masked\_accuracy](https://community.deeplearning.ai/t/c3w2-masked-accuracy/619695/4):
>
> Hello @skinx.learning no where it mentions to mask with 0, Lucas meant if you do not pass an axis argument, it takes the value default as 0, so check if you have chosen the correct value for axis. I will explain you step-wise on how the code should have looked. First I am hoping you have gone through the below instructions Then in the masked\_accuracy grader cell, the first code is to find loss for each items in batch, and You must always cast the t…

Regards  
DP
