# Exercise 6 - train\_step

**URL:** <https://community.deeplearning.ai/t/exercise-6-train-step/22988>\
**Category:** Convolutional Neural Networks\
**Tags:** coursera-platform\
**Created:** [July 24, 2021, 6:29am UTC](https://community.deeplearning.ai/t/exercise-6-train-step/22988 "2021-07-24T06:29:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![efanrzee](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/efanrzee/32/3205_2.png) [@efanrzee](https://community.deeplearning.ai/u/efanrzee)\
**Post date:** [July 24, 2021, 6:29am UTC](https://community.deeplearning.ai/t/exercise-6-train-step/22988/1 "2021-07-24T06:29:27Z")

</div>

## Hi I ran my code and faced this error. I computed a\_G as an output of VGG model, then I computed J\_content and J\_style using compute\_content\_cost and compute\_style\_cost functions. Finally, I used total\_cost function to calculate J.What is my mistake? tf.Tensor(3.949584e-14, shape=(), dtype=float32)

AssertionError Traceback (most recent call last)  
 in   
5 print(J1)  
6 assert type(J1) == EagerTensor, f"Wrong type {type(J1)} != {EagerTensor}"  
----\> 7 assert np.isclose(J1, 10221.168), f"Unexpected cost for epoch 0: {J1} != {10221.168}"  
8  
9 J2 = train\_step(generated\_image)

AssertionError: Unexpected cost for epoch 0: 3.9495838511597464e-14 != 10221.168

---

<div class="post-metadata">

**Author:** ![reinoudbosch](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@reinoudbosch](https://community.deeplearning.ai/u/reinoudbosch)\
**Post date:** [July 25, 2021, 3:25am UTC](https://community.deeplearning.ai/t/exercise-6-train-step/22988/2 "2021-07-25T03:25:32Z")

</div>

Hi efanrzee,

It may help to rerun all cells, or at least the cell containing UNQ\_C5. If this does not resolve things, feel free to send me your code so I can have a look what’s going on.

---

<div class="post-metadata">

**Author:** ![efanrzee](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/efanrzee/32/3205_2.png) [@efanrzee](https://community.deeplearning.ai/u/efanrzee)\
**Post date:** [July 25, 2021, 4:18am UTC](https://community.deeplearning.ai/t/exercise-6-train-step/22988/3 "2021-07-25T04:18:26Z")

</div>

Yeah, thank you. It was solved.

---

<div class="post-metadata">

**Author:** ![muhammadahmad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/muhammadahmad/32/5043_2.png) [@muhammadahmad](https://community.deeplearning.ai/u/muhammadahmad)\
**Post date:** [August 4, 2021, 3:33pm UTC](https://community.deeplearning.ai/t/exercise-6-train-step/22988/4 "2021-08-04T15:33:15Z")

</div>

Could you please help me with this issue?

---

<div class="post-metadata">

**Author:** ![reinoudbosch](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@reinoudbosch](https://community.deeplearning.ai/u/reinoudbosch)\
**Post date:** [August 7, 2021, 12:04am UTC](https://community.deeplearning.ai/t/exercise-6-train-step/22988/5 "2021-08-07T00:04:55Z")

</div>

Hi Muhammadahmad,

If this solution does not work for you, could you open a new post with a bit more detail as to the nature of the issue you’re facing? That way, other mentors can respond and this topic, which is considered to be solved, can be closed. Thanks!
