Skip to content
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

Gelu activation #187

Merged
merged 2 commits into from
Aug 20, 2021
Merged

Gelu activation #187

merged 2 commits into from
Aug 20, 2021

Conversation

therealansh
Copy link
Contributor

This PR adds Gelu Activation Function. closes #165

features, tf.math.add(
tf.constant(1.0f), tf.math.tanh(
tf.math.mul(
tf.constant(0.7978845608028654f),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like optimization to avoid the pi transformation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value is of sqrt(2/pi) to avoid a constant division i took this value. This is similar to tf.nn.gelu implementation. I could add in sqrt if you want?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to add it in the comments, for the future code readers

@zaleslaw zaleslaw added the LGTM PR reviewed and is ready to merge label Aug 17, 2021
@zaleslaw
Copy link
Collaborator

Thanks for the contribution! Where did you take the test data for Gelu?

@zaleslaw zaleslaw added Review This PR is under review and removed LGTM PR reviewed and is ready to merge labels Aug 17, 2021
@therealansh
Copy link
Contributor Author

Hey @zaleslaw I hope you are doing well, I took the test cases from tf.addons

@zaleslaw
Copy link
Collaborator

Ha-ha, @therealansh "I hope you are doing well" In this context looks like "hey, buddy, open your eyes, I hope you are able to read a code today":)

@therealansh
Copy link
Contributor Author

therealansh commented Aug 17, 2021

@zaleslaw Haha, no no I meant to ask about your well being only. And as for the PR i'll add some comments and docs about it.

@zaleslaw
Copy link
Collaborator

@therealansh please merge your branch with master; you will be the following in the merge queue (after that, I'll run the TC)

@zaleslaw zaleslaw merged commit 878dcde into Kotlin:master Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review This PR is under review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Gelu activation function
2 participants