# DLS C2W3 compute\_total\_loss\_test Grader Error (2024)

**URL:** <https://community.deeplearning.ai/t/dls-c2w3-compute-total-loss-test-grader-error-2024/566416>\
**Category:** Improving Deep Neural Networks: Hyperparameter tun\
**Tags:** week-module-3, coursera-platform\
**Created:** [February 6, 2024, 12:53pm UTC](https://community.deeplearning.ai/t/dls-c2w3-compute-total-loss-test-grader-error-2024/566416 "2024-02-06T12:53:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Buyasser](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Buyasser](https://community.deeplearning.ai/u/Buyasser)\
**Post date:** [February 6, 2024, 12:53pm UTC](https://community.deeplearning.ai/t/dls-c2w3-compute-total-loss-test-grader-error-2024/566416/1 "2024-02-06T12:53:45Z")

</div>

When creating a post, please add:

- Week # must be added in the tags option of the post.
- Link to the classroom item you are referring to:
- Description (include relevant info but please do not post solution code or your entire notebook)  
After coding the function “compute\_total\_loss” I keep getting same error from “compute\_total\_loss\_test Grader”. I just need someone to confirm that the grader is correct because when I removed the “tf.transpose” of “minibatch” in the “for loop” the grader was fine and the i get “All test passed”. Thanks in advance for your assistance.

---

<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:** [February 6, 2024, 2:04pm UTC](https://community.deeplearning.ai/t/dls-c2w3-compute-total-loss-test-grader-error-2024/566416/2 "2024-02-06T14:04:46Z")

</div>

Yes, grader is correct and you have to use that transpose. Please read [this](https://community.deeplearning.ai/t/week-3-exercise-6-compute-total-loss/306713/5) for more details.

---

<div class="post-metadata">

**Author:** ![Buyasser](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Buyasser](https://community.deeplearning.ai/u/Buyasser)\
**Post date:** [February 6, 2024, 2:23pm UTC](https://community.deeplearning.ai/t/dls-c2w3-compute-total-loss-test-grader-error-2024/566416/3 "2024-02-06T14:23:14Z")

</div>

Hi, I have seen the link you have shared, the issue is that when i use transpose (as it should be) in the “compute\_total\_loss” function I get the grader error and when I move to the next section “3.3- Train the model” it shows in model function code that in this code line “minibatch\_total\_loss = compute\_total\_loss(Z3, tf.transpose(minibatch\_Y))” that the transpose is in the argument itself, this way i get another error after running this code \<parameters, costs, train\_acc, test\_acc = model(new\_train, new\_y\_train, new\_test, new\_y\_test, num\_epochs=100)\> but if i remove the transpose from this code line “minibatch\_total\_loss = compute\_total\_loss(Z3, tf.transpose(minibatch\_Y))” to be this “minibatch\_total\_loss = compute\_total\_loss(Z3, (minibatch\_Y))” in that case i get everything in good order and all results / outputs are as expected.

---

<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:** [February 6, 2024, 2:35pm UTC](https://community.deeplearning.ai/t/dls-c2w3-compute-total-loss-test-grader-error-2024/566416/4 "2024-02-06T14:35:01Z")

</div>

> [@Buyasser](#):
>
> the issue is that when i use transpose (as it should be) in the “compute\_total\_loss” function I get the grader error and when I move to the next section

What error you are getting? Please share that with us. And never move to the next section until you passed the previous section. Also, make sure you are using the transpose of TensorFlow (very important) for both, labels and logits. And, `from_logits=True`.

---

<div class="post-metadata">

**Author:** ![Buyasser](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Buyasser](https://community.deeplearning.ai/u/Buyasser)\
**Post date:** [February 6, 2024, 2:44pm UTC](https://community.deeplearning.ai/t/dls-c2w3-compute-total-loss-test-grader-error-2024/566416/5 "2024-02-06T14:44:52Z")

</div>

Hi, thanks indeed Saif for you valuable input, it helped me to fix it and trust now all is in good order.
