Repository navigation
feat: add math/base/special/gelu - #15754
AryanSharma48 wants to merge 6 commits into
Conversation
Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
Coverage Report
The above coverage report was generated for the changes in this PR. |
math/base/special/gelu
|
Following up on the discussion from the 6 Oct 2026 office hours on the API design for Ecosystem Analysis
Python frameworks favor kwargs because option parsing is negligible next to tensor kernel execution. The 1.702 variant, Proposed APIV8 penalizes polymorphic functions and options-object parsing in hot loops, so I propose explicit methods (as in Julia and Rust) with exact precision as the default (as in PyTorch and TF): var gelu = require( '@stdlib/math/base/special/gelu' );
gelu( x ); // Exact, x * Phi(x)
gelu.tanh( x ); // Tanh approximation
gelu.quick( x ); // 1.702 approximationI suggest Numerical Stability and Testing
Open Questions
Unless you object, cc @kgryte |
Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
|
Following up on our alignment from office hours on 13th Oct 26: I am going to update this PR to strictly focus on the exact GELU implementation ( I will remove the |
Signed-off-by: Aryan Sharma <aryansharma24106@gmail.com>
Part of #15575
Description
This pull request:
@stdlib/math/base/special/geluto evaluate the Gaussian Error Linear Unit (GELU) activation function.@stdlib/math/base/special/erfcto prevent catastrophic cancellation for negative values.NaN, and±Infinity.Related Issues
This pull request has the following related issues:
@stdlib/math/base/special#15575Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
I consulted an AI assistant for research and mathematical understanding of the GELU formulation and repository conventions, while the changes were authored in accordance with canonical
@stdlibguidelines.@stdlib-js/reviewers