Skip to content

Fix calculation of current item number in optimization_tutorial.py #2743

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

Merged
merged 3 commits into from
Jan 31, 2024

Conversation

anttikup
Copy link
Contributor

@anttikup anttikup commented Jan 23, 2024

Current item calculation gave the wrong number when dataset doesn't split to batches equally.

Fixes #2742

Description

Change (batch + 1) * len(X) to batch * batch_size + len(X)

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
  • No unnecessary issues are included into this pull request.

cc @subramen @albanD

Current item calculation gave the wrong number when dataset doesn't split to batches equally.
Copy link

pytorch-bot bot commented Jan 23, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (4 Unrelated Failures)

As of commit 0331944 with merge base 49c1494 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

@anttikup anttikup marked this pull request as ready for review January 24, 2024 06:51
@svekars svekars added the core Tutorials of any level of difficulty related to the core pytorch functionality label Jan 29, 2024
Copy link
Contributor

@albanD albanD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@svekars svekars merged commit 43bd101 into pytorch:main Jan 31, 2024
svekars added a commit that referenced this pull request Feb 2, 2024
…2743)

Current item calculation gave the wrong number when dataset doesn't split to batches equally.

Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed core Tutorials of any level of difficulty related to the core pytorch functionality intro
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Current item calculation in Optimization tutorial prints wrong number when data set length doesn't split evenly to batches
5 participants