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

Zhijxu/fix softmax fp16 #20059

Merged
merged 3 commits into from
Mar 27, 2024
Merged

Zhijxu/fix softmax fp16 #20059

merged 3 commits into from
Mar 27, 2024

Conversation

zhijxu-MS
Copy link
Contributor

in fp16 input, the softmax will return nan in some case,

the reason is because in float16 dtype, std::numeric_limits::infinity() will return 0 instead of inf

@zhijxu-MS zhijxu-MS requested a review from pengwa March 25, 2024 09:29
pengwa
pengwa previously approved these changes Mar 25, 2024
Copy link
Contributor

@pengwa pengwa left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.

@pengwa pengwa added the training issues related to ONNX Runtime training; typically submitted using template label Mar 25, 2024
@zhijxu-MS zhijxu-MS force-pushed the zhijxu/fix-softmax-fp16 branch from 0952694 to a5ddc2f Compare March 26, 2024 02:45
in float16 dtype, std::numeric_limits<float16>::infinity() will return 0 instead of inf
@zhijxu-MS zhijxu-MS force-pushed the zhijxu/fix-softmax-fp16 branch from a5ddc2f to 8f04cbb Compare March 27, 2024 01:07
@zhijxu-MS zhijxu-MS merged commit b14d3f1 into main Mar 27, 2024
91 of 95 checks passed
@zhijxu-MS zhijxu-MS deleted the zhijxu/fix-softmax-fp16 branch March 27, 2024 03:37
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request May 7, 2024
in fp16 input, the softmax will return nan in some case, 

the reason is because in float16 dtype,
std::numeric_limits<float16>::infinity() will return 0 instead of inf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training issues related to ONNX Runtime training; typically submitted using template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants