# Programming Assignment: TensorFlow Introduction

**URL:** <https://community.deeplearning.ai/t/programming-assignment-tensorflow-introduction/132059>\
**Category:** Improving Deep Neural Networks: Hyperparameter tun\
**Tags:** coursera-platform\
**Created:** [May 27, 2022, 5:26pm UTC](https://community.deeplearning.ai/t/programming-assignment-tensorflow-introduction/132059 "2022-05-27T17:26:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atnafu\_Abrham\_Lencha](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Atnafu\_Abrham\_Lencha](https://community.deeplearning.ai/u/Atnafu_Abrham_Lencha)\
**Post date:** [May 27, 2022, 5:26pm UTC](https://community.deeplearning.ai/t/programming-assignment-tensorflow-introduction/132059/1 "2022-05-27T17:26:37Z")

</div>

From the PDF file, I want to know what is wrong on the funtion of to compute cost? the function is :-

# GRADED FUNCTION: compute\_cost

def compute\_cost(logits, labels):  
cost=tf.reduce\_mean(tf.keras.losses.categorical\_crossentropy(y\_true=labels,y\_pred=logits))

# YOUR CODE ENDS HERE

```
return cost

```

---

<div class="post-metadata">

**Author:** ![anon57530071](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@anon57530071](https://community.deeplearning.ai/u/anon57530071)\
**Post date:** [May 27, 2022, 5:42pm UTC](https://community.deeplearning.ai/t/programming-assignment-tensorflow-introduction/132059/2 "2022-05-27T17:42:38Z")

</div>

Welcome to our community !  
I think you are very close. You need to add one more parameter for your “tf.keras.losses.categorical\_crossentropy()”.

**from\_logits** : Whether y\_pred is expected to be a logits tensor. By default, we assume that y\_pred encodes a probability distribution.

By the way, it is better not to attach any solution in here. Please remove PDF file. Thank you.

---

<div class="post-metadata">

**Author:** ![Atnafu\_Abrham\_Lencha](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Atnafu\_Abrham\_Lencha](https://community.deeplearning.ai/u/Atnafu_Abrham_Lencha)\
**Post date:** [May 27, 2022, 6:07pm UTC](https://community.deeplearning.ai/t/programming-assignment-tensorflow-introduction/132059/3 "2022-05-27T18:07:26Z")

</div>

Noted with thanks,  
How pdf file is deleted? I tried a couple of options but it was’nt deleted
