Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
77b75d2c
Unverified
Commit
77b75d2c
authored
Apr 23, 2020
by
mneilly-et
Committed by
GitHub
Apr 23, 2020
Browse files
Fix for #3873 to change type of exponent parameter for torch.pow() call from int to float (#3924)
parent
6ba254ee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/activations.py
src/transformers/activations.py
+1
-1
No files found.
src/transformers/activations.py
View file @
77b75d2c
...
@@ -26,7 +26,7 @@ def gelu_new(x):
...
@@ -26,7 +26,7 @@ def gelu_new(x):
""" Implementation of the gelu activation function currently in Google Bert repo (identical to OpenAI GPT).
""" Implementation of the gelu activation function currently in Google Bert repo (identical to OpenAI GPT).
Also see https://arxiv.org/abs/1606.08415
Also see https://arxiv.org/abs/1606.08415
"""
"""
return
0.5
*
x
*
(
1
+
torch
.
tanh
(
math
.
sqrt
(
2
/
math
.
pi
)
*
(
x
+
0.044715
*
torch
.
pow
(
x
,
3
))))
return
0.5
*
x
*
(
1
+
torch
.
tanh
(
math
.
sqrt
(
2
/
math
.
pi
)
*
(
x
+
0.044715
*
torch
.
pow
(
x
,
3
.0
))))
if
torch
.
__version__
<
"1.4.0"
:
if
torch
.
__version__
<
"1.4.0"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment