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
05e8bfde
"...targets/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "b2f08d9844af9d640ad8d1c6df26809a3682fc50"
Commit
05e8bfde
authored
May 20, 2022
by
turneram
Browse files
Formatting
parent
3ea9fe4c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
10 deletions
+14
-10
src/onnx/parse_layernorm.cpp
src/onnx/parse_layernorm.cpp
+5
-4
test/verify/0layernorm_test.cpp
test/verify/0layernorm_test.cpp
+3
-2
test/verify/0transposectx_test.cpp
test/verify/0transposectx_test.cpp
+3
-2
test/verify/0transposeqkv_test.cpp
test/verify/0transposeqkv_test.cpp
+3
-2
No files found.
src/onnx/parse_layernorm.cpp
View file @
05e8bfde
...
...
@@ -19,7 +19,7 @@ struct parse_layernorm : op_parser<parse_layernorm>
const
std
::
vector
<
instruction_ref
>&
args
)
const
{
float
epsilon
=
1e-3
f
;
int64_t
axis
=
-
1
;
int64_t
axis
=
-
1
;
if
(
contains
(
info
.
attributes
,
"epsilon"
))
{
epsilon
=
parser
.
parse_value
(
info
.
attributes
.
at
(
"epsilon"
)).
at
<
float
>
();
...
...
@@ -29,14 +29,15 @@ struct parse_layernorm : op_parser<parse_layernorm>
epsilon
=
parser
.
parse_value
(
info
.
attributes
.
at
(
"axis"
)).
at
<
int64_t
>
();
}
auto
layernorm
=
info
.
add_instruction
(
make_op
(
"layernorm"
,
{{
"epsilon"
,
epsilon
},
{
"axis"
,
axis
}}),
args
.
front
());
auto
layernorm
=
info
.
add_instruction
(
make_op
(
"layernorm"
,
{{
"epsilon"
,
epsilon
},
{
"axis"
,
axis
}}),
args
.
front
());
if
(
args
.
size
()
==
3
)
if
(
args
.
size
()
==
3
)
{
layernorm
=
info
.
add_broadcastable_binary_op
(
"mul"
,
layernorm
,
args
.
at
(
1
));
layernorm
=
info
.
add_broadcastable_binary_op
(
"add"
,
layernorm
,
args
.
at
(
2
));
}
return
layernorm
;
}
};
...
...
test/verify/0layernorm_test.cpp
View file @
05e8bfde
...
...
@@ -9,9 +9,10 @@ struct test_layernorm : verify_program<test_layernorm>
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
384
,
768
}});
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
384
,
768
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"layernorm"
,
{{
"axis"
,
-
1
}}),
x
);
return
p
;
}
};
\ No newline at end of file
test/verify/0transposectx_test.cpp
View file @
05e8bfde
...
...
@@ -9,9 +9,10 @@ struct test_transposectx : verify_program<test_transposectx>
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
12
,
128
,
64
}});
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
12
,
128
,
64
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"transposectx"
),
x
);
return
p
;
}
};
test/verify/0transposeqkv_test.cpp
View file @
05e8bfde
...
...
@@ -9,9 +9,10 @@ struct test_transposeqkv : verify_program<test_transposeqkv>
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
384
,
3
,
12
,
64
}});
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
384
,
3
,
12
,
64
}});
mm
->
add_instruction
(
migraphx
::
make_op
(
"transposeqkv"
),
x
);
return
p
;
}
};
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