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

Merged
merged 6 commits into from
Jun 12, 2025

Conversation

valerioedu
Copy link
Contributor

  • 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
Contributor 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

@jmitrevs jmitrevs added the please test Trigger testing by creating local PR branch label Jun 11, 2025
@jmitrevs
Copy link
Contributor

There is a selu test in test_activations, so if the standard pytests pass (which I just started), I would suggest we merge this.

@jmitrevs jmitrevs added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Jun 11, 2025
@jmitrevs jmitrevs merged commit a07d4f1 into fastmachinelearning:main Jun 12, 2025
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please test Trigger testing by creating local PR branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants