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
a48c41a9
Commit
a48c41a9
authored
Aug 22, 2022
by
turneram
Browse files
Formatting
parent
fb6de954
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/rewrite_gelu.cpp
src/rewrite_gelu.cpp
+1
-1
test/verify/test_add_gelu_half.cpp
test/verify/test_add_gelu_half.cpp
+6
-6
No files found.
src/rewrite_gelu.cpp
View file @
a48c41a9
...
@@ -38,7 +38,7 @@ struct find_gelu_erf
...
@@ -38,7 +38,7 @@ struct find_gelu_erf
{
{
auto
ins
=
r
.
result
;
auto
ins
=
r
.
result
;
auto
x
=
r
.
instructions
[
"x"
];
auto
x
=
r
.
instructions
[
"x"
];
if
(
x
->
get_shape
().
type
()
!=
migraphx
::
shape
::
half_type
)
if
(
x
->
get_shape
().
type
()
!=
migraphx
::
shape
::
half_type
)
return
;
return
;
auto
lit
=
m
.
add_literal
(
literal
{
shape
{
x
->
get_shape
().
type
()},
{
1.702
f
}});
auto
lit
=
m
.
add_literal
(
literal
{
shape
{
x
->
get_shape
().
type
()},
{
1.702
f
}});
...
...
test/verify/test_add_gelu_half.cpp
View file @
a48c41a9
...
@@ -34,12 +34,12 @@ struct test_add_gelu_half : verify_program<test_add_gelu_half>
...
@@ -34,12 +34,12 @@ struct test_add_gelu_half : verify_program<test_add_gelu_half>
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
size_t
>
input_lens
{
1
,
1
,
5
};
std
::
vector
<
size_t
>
input_lens
{
1
,
1
,
5
};
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
half_type
,
input_lens
});
auto
x
=
mm
->
add_parameter
(
"x"
,
{
migraphx
::
shape
::
half_type
,
input_lens
});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
half_type
,
input_lens
});
auto
y
=
mm
->
add_parameter
(
"y"
,
{
migraphx
::
shape
::
half_type
,
input_lens
});
auto
half
=
mm
->
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
half_type
},
{
0.5
f
}});
auto
half
=
mm
->
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
half_type
},
{
0.5
f
}});
auto
one
=
mm
->
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
half_type
},
{
1.0
f
}});
auto
one
=
mm
->
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
half_type
},
{
1.0
f
}});
auto
sqrt2
=
mm
->
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
half_type
},
{
M_SQRT2
}});
auto
sqrt2
=
mm
->
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
half_type
},
{
M_SQRT2
}});
auto
add
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
auto
add
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
auto
half_mbcast
=
mm
->
add_instruction
(
auto
half_mbcast
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
half
);
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
input_lens
}}),
half
);
auto
mul_half
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
add
,
half_mbcast
);
auto
mul_half
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"mul"
),
add
,
half_mbcast
);
...
...
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