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
gaoqiong
MIGraphX
Commits
6f692ebd
Commit
6f692ebd
authored
Jul 11, 2022
by
turneram
Browse files
Formatting
parent
35f709a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
src/rewrite_gelu.cpp
src/rewrite_gelu.cpp
+8
-8
test/rewrite_gelu_test.cpp
test/rewrite_gelu_test.cpp
+3
-4
No files found.
src/rewrite_gelu.cpp
View file @
6f692ebd
...
@@ -33,8 +33,8 @@ struct find_gelu_erf
...
@@ -33,8 +33,8 @@ struct find_gelu_erf
{
{
static
auto
match_div
()
static
auto
match_div
()
{
{
return
match
::
name
(
"div"
)(
return
match
::
name
(
"div"
)(
match
::
either_arg
(
0
,
1
)(
match
::
either_arg
(
0
,
1
)(
match
::
any
().
bind
(
"x"
),
match
::
skip_broadcasts
(
match
::
has_value
(
1.414
f
,
1e-3
))));
match
::
any
().
bind
(
"x"
),
match
::
skip_broadcasts
(
match
::
has_value
(
1.414
f
,
1e-3
))));
}
}
static
auto
match_erf
()
{
return
match
::
name
(
"erf"
)(
match
::
arg
(
0
)(
match_div
()));
}
static
auto
match_erf
()
{
return
match
::
name
(
"erf"
)(
match
::
arg
(
0
)(
match_div
()));
}
...
@@ -45,7 +45,10 @@ struct find_gelu_erf
...
@@ -45,7 +45,10 @@ struct find_gelu_erf
match
::
either_arg
(
0
,
1
)(
match_erf
(),
match
::
skip_broadcasts
(
match
::
has_value
(
1.0
f
))));
match
::
either_arg
(
0
,
1
)(
match_erf
(),
match
::
skip_broadcasts
(
match
::
has_value
(
1.0
f
))));
}
}
static
auto
match_mul
()
{
return
match
::
name
(
"mul"
)(
match
::
either_arg
(
0
,
1
)(
match
::
any
(),
match_add
()));
}
static
auto
match_mul
()
{
return
match
::
name
(
"mul"
)(
match
::
either_arg
(
0
,
1
)(
match
::
any
(),
match_add
()));
}
auto
matcher
()
const
auto
matcher
()
const
{
{
...
@@ -74,10 +77,7 @@ struct find_gelu_erf
...
@@ -74,10 +77,7 @@ struct find_gelu_erf
}
}
};
};
void
rewrite_gelu
::
apply
(
module
&
m
)
const
void
rewrite_gelu
::
apply
(
module
&
m
)
const
{
match
::
find_matches
(
m
,
find_gelu_erf
{});
}
{
match
::
find_matches
(
m
,
find_gelu_erf
{});
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
test/rewrite_gelu_test.cpp
View file @
6f692ebd
...
@@ -37,7 +37,6 @@
...
@@ -37,7 +37,6 @@
#include <migraphx/verify.hpp>
#include <migraphx/verify.hpp>
TEST_CASE
(
bias_gelu
)
TEST_CASE
(
bias_gelu
)
{
{
migraphx
::
shape
s1
{
migraphx
::
shape
::
half_type
,
{
2
,
4
,
8
}};
migraphx
::
shape
s1
{
migraphx
::
shape
::
half_type
,
{
2
,
4
,
8
}};
...
...
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