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

Use float data type for Half var_sum in batchnorm stats updating on CPU #126525

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CaoE
Copy link
Collaborator

@CaoE CaoE commented May 17, 2024

Using float data type for Half var_sum in batchnorm stats updating on CPU to avoid var_sum overflow since the representation range of Half is small.

Copy link

pytorch-bot bot commented May 17, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit fb6860f with merge base 8a45979 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added the release notes: nn release notes category label May 17, 2024
@CaoE CaoE added the ciflow/trunk Trigger trunk jobs on your pull request label May 17, 2024
@CaoE CaoE changed the title Use float data type for var_sum in batchnorm stats updating on CPU Use float data type for Half var_sum in batchnorm stats updating on CPU May 17, 2024
Comment on lines +214 to +216
if (dtype == kHalf) {
dtype = kFloat;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add some comments here to explain why we are doing so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request open source release notes: nn release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants