Tensorflow Exercise 6 - compute cost

Hi Mentors
,
I’m struggling with Exercise 6 - compute_cost. Can you give me any guidance in light of the following?

I can see that the labels are 1 or 0, and that the logits seem to be probabilities, hence from_logits=False, but something seems to be amiss.

Any guidance appreciated.

Regards, Harry

@FatHaz
These are logits not probabilities. Adjust your cost function accordingly.
Change the argument from_logits and you will get the correct answer.

Hi @AnkitSaini
Thank you for your help. Fortunately, I’d managed to see the error of my ways last night and completed the course! I’m very grateful to you for offering to help though.
Regards, Harry

@FatHaz
You’re welcome

Just following up on this question, why do I need to transform the logits and labels for cross-entropy function. This wouldn’t be the case in other packages like sklearn. I am just curious to know why it is approached this like?