Skip to content

Outputs for classification model are logits or y_pred? #310

Discussion options

You must be logged in to vote

Hi @pusapatiakhilraju,

This looks like it may be a naming issue.

E.g. y_pred in the code you're sharing (see here in the book: https://www.learnpytorch.io/03_pytorch_computer_vision/#33-creating-a-training-loop-and-training-a-model-on-batches-of-data) could also be called y_logits.

Because the loss_fn = nn.CrossEntropyLoss(), this loss function can take raw logits (the raw output of the model, which is called y_pred in this case) directly.

In the code above, if you named y_pred as y_logits, you would get the same results.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@pusapatiakhilraju
Comment options

@mrdbourke
Comment options

Answer selected by pusapatiakhilraju
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants