|TensorFlow 2 version||View source on GitHub|
Computes softmax cross entropy between
Compat aliases for migration
See Migration guide for more details.
tf.nn.softmax_cross_entropy_with_logits( _sentinel=None, labels=None, logits=None, dim=-1, name=None, axis=None )
Future major versions of TensorFlow will allow gradients to flow into the labels input on backprop by default.
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.
If using exclusive
labels (wherein one and only
one class is true at a time), see
A common use case is to have logits and labels of shape
[batch_size, num_classes], but higher dimensions are supported, with
dim argument specifying the class dimension.
Backpropagation will happen only into
logits. To calculate a cross entropy
loss that allows backpropagation into both
Note that to avoid confusion, it is required to pass only named arguments to this function.
||Used to prevent positional parameters. Internal, do not use.|
Each vector along the class dimension should hold a valid
probability distribution e.g. for the case in which labels are of shape
||Per-label activations, typically a linear output. These activation energies are interpreted as unnormalized log probabilities.|
||The class dimension. Defaulted to -1 which is the last dimension.|
||A name for the operation (optional).|
||Alias for dim.|