Computes sparse softmax cross entropy between
tf.compat.v2.nn.sparse_softmax_cross_entropy_with_logits( labels, logits, name=None )
Measures the probability error in discrete classification tasks in which the classes are mutually exclusive (each entry is in exactly one class). For example, each CIFAR-10 image is labeled with one and only one label: an image can be a dog or a truck, but not both.
Note: For this operation, the probability of a given label is considered exclusive. That is, soft classes are not allowed, and the
labelsvector must provide a single specific index for the true class for each row of
logits(each minibatch entry). For soft softmax classification with a probability distribution for each entry, see
A common use case is to have logits of shape
[batch_size, num_classes] and have labels of shape
[batch_size], but higher dimensions are supported, in which case the
dim-th dimension is assumed to be of size
logits must have the dtype of
labels must have the dtype of
Note that to avoid confusion, it is required to pass only named arguments to this function.
| || |
| || Unscaled log probabilities of shape |
| ||A name for the operation (optional).|
| A |
| ||If logits are scalars (need to have rank >= 1) or if the rank of the labels is not equal to the rank of the logits minus one.|
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.