CrossEntropyLoss — PyTorch 1.10.1 documentation
pytorch.org › torchThe latter is useful for higher dimension inputs, such as computing cross entropy loss per-pixel for 2D images. The target that this criterion expects should contain either: Class indices in the range [ 0 , C − 1 ] [0, C-1] [ 0 , C − 1 ] where C C C is the number of classes; if ignore_index is specified, this loss also accepts this class ...
Categorical cross entropy loss function equivalent in PyTorch ...
discuss.pytorch.org › t › categorical-cross-entropyJun 12, 2020 · sparse_categorical_crossentropy(scce) produces a category index of the most likelymatching category. I think this is the one used by Pytroch Consider a classification problem with 5 categories (or classes). In the case of cce, the one-hot target may be [0, 1, 0, 0, 0]and the model may predict [.2, .5, .1, .1, .1](probably right)