Skip to content

enhanced numeric stability for low prec. compute #43

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

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

Conversation

RsqM
Copy link

@RsqM RsqM commented Feb 26, 2025

Adding 1e-8 after division slightly shifts all outputs away from zero but doesn’t prevent division errors if sum_exp_x is exactly zero. Instead, adding it before division ensures sum_exp_x is never zero, avoiding potential division errors and preventing extreme values like inf or NaN, especially in low-precision computations

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

Successfully merging this pull request may close these issues.

1 participant