Skip to content

Fix SeLU lambda precision (Follow-up to #1287) #1298

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 5 commits into
base: main
Choose a base branch
from

Conversation

valerioedu
Copy link

  • Replaced literal cast 1.050700987… → res_T with a static const ap_fixed<16,1> lambda, preserving range and ~1.5 × 10⁻² LSB precision regardless of user-chosen res_T.

  • Removed redundant datareg scope; now a single per-element branch: if (x ≥ 0) y = λ · x
    else y = selu_table[idx] (with index clamped to [0,N-1]).

  • Guard against negative-index underflow; behaviour for <0 inputs unchanged.

@vloncar
Copy link
Contributor

vloncar commented May 13, 2025

Can you add a test case that demonstrates that this is indeed working as expected and improves upon the current implementation? Should be straightforward

@valerioedu
Copy link
Author

Can you add a test case that demonstrates that this is indeed working as expected and improves upon the current implementation? Should be straightforward

where should I commit the new test case?

@vloncar
Copy link
Contributor

vloncar commented May 13, 2025

Look under tests/pytest

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.

2 participants