Skip to content

Add approximate parameter to GELU activation function#1548

Open
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
alinpahontu2912:feature/gelu-approximate-parameter
Open

Add approximate parameter to GELU activation function#1548
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
alinpahontu2912:feature/gelu-approximate-parameter

Conversation

@alinpahontu2912
Copy link
Member

Fixes #1368

Add support for the 'approximate' parameter in GELU, matching PyTorch's torch.nn.GELU(approximate='tanh') functionality.

Changes:

  • Add GELU.Approximate enum with 'none' and 'tanh' values
  • Thread approximate parameter through all layers: native C++, PInvoke, Tensor methods, functional API, and module factory
  • Add new overloads (no breaking changes to existing API)
  • Add test for tanh approximation mode

Add support for the 'approximate' parameter in GELU, matching PyTorch's
torch.nn.GELU(approximate='tanh') functionality.

Changes:
- Add GELU.Approximate enum with 'none' and 'tanh' values
- Thread approximate parameter through all layers: native C++, PInvoke,
  Tensor methods, functional API, and module factory
- Add new overloads (no breaking changes to existing API)
- Add test for tanh approximation mode

Fixes dotnet#1368

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

GELU does not appear to support approximate tanh

1 participant