Skip to content

Clarify model output dimensions in buildmodel tutorial - #3968

Open
MichelleHan7 wants to merge 1 commit into
pytorch:mainfrom
MichelleHan7:fix-buildmodel-output-dims
Open

MichelleHan7 wants to merge 1 commit into
pytorch:mainfrom
MichelleHan7:fix-buildmodel-output-dims

Conversation

@MichelleHan7

Copy link
Copy Markdown

Fixes #3622

Description

In the "Build the Neural Network" tutorial, the sentence describing the output of model(X) says dim=0 corresponds to "each output of 10 raw predicted values for each class" and dim=1 to "the individual values of each output." It reads as if dim=0 held the 10 class scores, and it never mentions the batch dimension.

This PR rewrites that sentence to give the output shape, (batch_size, 10): dim=0 corresponds to each sample in the batch, and dim=1 to the logits for each of the 10 classes. That matches the code right after it, which applies nn.Softmax(dim=1) and argmax(1) over the class dimension, and the "minibatch dimension (at dim=0)" wording later in the same tutorial. Only the comment changes; the code is untouched.

This picks up #3623 by @vaharoni, which was approved but closed by the stale bot before it was merged.

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request (the issue is labeled bug; I can't add labels as an outside contributor)
  • No unnecessary issues are included into this pull request.

🤖 Generated with Claude Code

The sentence describing the output of model(X) read as if dim=0 held
the 10 class scores, and it never mentioned the batch dimension. State
the output shape (batch_size, 10) and what each dimension holds.

Fixes pytorch#3622

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pytorch-bot

pytorch-bot Bot commented Sep 25, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3968

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla

meta-cla Bot commented Sep 25, 2026

Copy link
Copy Markdown

Hi @MichelleHan7!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Sep 25, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the cla signed label Sep 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - Minor: incorrect description in the Build the Neural Network tutorial

1 participant