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
1e53faeb
"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "ce37b8e4819142171b61558e64f7dcb0286e9937"
Unverified
Commit
1e53faeb
authored
Oct 26, 2021
by
Lysandre Debut
Committed by
GitHub
Oct 26, 2021
Browse files
Fix gelu test for torch 1.10 (#14167)
parent
8ddbfe97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
tests/test_activations.py
tests/test_activations.py
+2
-2
No files found.
tests/test_activations.py
View file @
1e53faeb
...
@@ -29,8 +29,8 @@ class TestActivations(unittest.TestCase):
...
@@ -29,8 +29,8 @@ class TestActivations(unittest.TestCase):
def
test_gelu_versions
(
self
):
def
test_gelu_versions
(
self
):
x
=
torch
.
tensor
([
-
100
,
-
1
,
-
0.1
,
0
,
0.1
,
1.0
,
100
])
x
=
torch
.
tensor
([
-
100
,
-
1
,
-
0.1
,
0
,
0.1
,
1.0
,
100
])
torch_builtin
=
get_activation
(
"gelu"
)
torch_builtin
=
get_activation
(
"gelu"
)
self
.
assertTrue
(
torch
.
e
q
(
_gelu_python
(
x
),
torch_builtin
(
x
))
.
all
().
item
()
)
self
.
assertTrue
(
torch
.
allclos
e
(
_gelu_python
(
x
),
torch_builtin
(
x
)))
self
.
assertFalse
(
torch
.
e
q
(
_gelu_python
(
x
),
gelu_new
(
x
))
.
all
().
item
()
)
self
.
assertFalse
(
torch
.
allclos
e
(
_gelu_python
(
x
),
gelu_new
(
x
)))
def
test_get_activation
(
self
):
def
test_get_activation
(
self
):
get_activation
(
"swish"
)
get_activation
(
"swish"
)
...
...
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