medium10 pts · first answer countspytorchloss-functions
Softmax before CrossEntropyLoss
What is wrong with this classification loss code?
probs = torch.softmax(logits, dim=1) loss = nn.CrossEntropyLoss()(probs, targets) # targets: class indices
Discussion 0
Join free to post in the discussion.
Related questions
- Dropout after eval()Machine Learning Engineer
- Expected starting loss, 10 classesMachine Learning Engineer
- Different results every inference runMachine Learning Engineer
- Log loss of a poor predictionMachine Learning Engineer
- Gradient of a sum of squaresMachine Learning Engineer
- Training loop without zero_gradMachine Learning Engineer
- Shape after a batched matmulMachine Learning Engineer
- view() after a transposeMachine Learning Engineer