During training, our goal is to minimize prediction error. We combine the softmax probability output with the cross-entropy loss function.
For a single one-hot target, the loss is simply the negative log of the predicted probability for the correct class: L=−ln(ptrue).