I was going through the tensorflow API docs here. In the tensorflow documentation, they used a keyword called logits. What is it? In a lot of methods in the API docs it is written like

`tf.nn.softmax(logits, name=None)`

If what is written is those logits are only Tensors, why keeping a different name like logits?

Another thing is that there are two methods I could not differentiate. They were

```tf.nn.softmax(logits, name=None)
tf.nn.softmax_cross_entropy_with_logits(logits, labels, name=None)```

What are the differences between them? The docs are not clear to me. I know what tf.nn.softmaxdoes. But not the other. An example will be really helpful. Nov 12, 2018 in Python 1,029 views

## 1 answer to this question.

Suppose you have two tensors, where y_hat contains computed scores for each class (for example, from y = W*x +b) and y_true contains one-hot encoded true labels.

```y_hat  = ... # Predicted label, e.g. y = tf.matmul(X, W) + b
y_true = ... # True label, one-hot encoded```

If you interpret the scores in y_hat as unnormalized log probabilities, then they are logits.

Additionally, the total cross-entropy loss computed in this manner:

```y_hat_softmax = tf.nn.softmax(y_hat)
total_loss = tf.reduce_mean(-tf.reduce_sum(y_true * tf.log(y_hat_softmax), ))```

is essentially equivalent to the total cross-entropy loss computed with the function softmax_cross_entropy_with_logits():

`total_loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(y_hat, y_true))` answered Nov 12, 2018 by
• 3,520 points

+1 vote

## What do you mean by python scripting? What is a script and a module in python?

A module is a file containing a ...READ MORE

+1 vote

## What is the difference between range and xrange functions in Python 2.X?

xrange only stores the range params and ...READ MORE

## What is a Tuple in Python and how to use it?

it is a python sequency which stores ...READ MORE

## In Python, what is difference between Array and List?

Lists and arrays are used in Python ...READ MORE

+1 vote

## how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

## how do i use the enumerate function inside a list?

can you give an example using a ...READ MORE

## Lowercase in Python

You can simply the built-in function in ...READ MORE