Adding activation functions and fast LUT implementation#177
Merged
Conversation
added 5 commits
January 8, 2026 12:32
…how activations classes are pre-instantiated in activations.cpp.
…ode currently using the default constructor.
…e/disable LUT for tanh and sigmoid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the SiLU (Swish) and HardSwish activations to core, as well as changes LeakyReLU into a parameterizeable function. It also adds an activation class that converts any C++ function with one float input argument into a LUT implementation with N points and linear interpolation between points.
Tests were added for the fast LUT implementation to make sure the results are close to the standard C++ implementations. With a LUT using 1024 entries, we get the following results in the tests for sigmoid(1.25) and tanh(1.25):
The LUT implementations can be activated to replace the original activations just like it is currently done for fasttanh.
Developed with support and sponsorship from TONE3000