Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Intro to Pytorch], "logits" output name causes confusing? #11

Closed
hpkhanh1610 opened this issue Nov 9, 2018 · 2 comments
Closed

[Intro to Pytorch], "logits" output name causes confusing? #11

hpkhanh1610 opened this issue Nov 9, 2018 · 2 comments
Assignees

Comments

@hpkhanh1610
Copy link

hpkhanh1610 commented Nov 9, 2018

Hi,

For the notebook "Part 3 - Training Neural Networks (Solution).ipynb" in Intro to Pytorch, in the 3rd code cell (I pasted it below), I see that we use the nn.LogSoftmax() layer at the end, so I think at the forward pass step, logits = model(images), the name of the output is not logits, I think we should use another name, like just "output" or "logsoftmax_output".

model = nn.Sequential(nn.Linear(784, 128),
                      nn.ReLU(),
                      nn.Linear(128, 64),
                      nn.ReLU(),
                      nn.Linear(64, 10),
                      **nn.LogSoftmax(dim=1)**)

# Define the loss
criterion = nn.NLLLoss()

# Get our data
images, labels = next(iter(trainloader))
# Flatten images
images = images.view(images.shape[0], -1)

**# Forward pass, get our logits
logits = model(images)
# Calculate the loss with the logits and the labels
loss = criterion(logits, labels) ```**
@mcleonard
Copy link
Contributor

Right, I'll fix this.

@mcleonard mcleonard self-assigned this Nov 12, 2018
@mcleonard
Copy link
Contributor

Fixed in this commit: 05105e7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants