Softmax + Cross-Entropy Loss - PyTorch Forums
discuss.pytorch.org › t › softmax-cross-entropy-lossJun 29, 2021 · Hello, My network has Softmax activation plus a Cross-Entropy loss, which some refer to Categorical Cross-Entropy loss. See: In binary classification, do I need one-hot encoding to work in a network like this in PyTorch? I am using Integer Encoding. Just as matter of fact, here are some outputs WITHOUT Softmax activation (batch = 4): outputs: tensor([[ 0.2439, 0.0890], [ 0.2258, 0.1119], [-0 ...
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 ...