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
40dcfa6b
Commit
40dcfa6b
authored
Dec 06, 2018
by
Khalique
Browse files
added more operator parsers with edge cases
parent
1a2e5c11
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
1 deletion
+33
-1
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+1
-1
test/onnx/add_scalar_test.onnx
test/onnx/add_scalar_test.onnx
+0
-0
test/onnx/gemm_test.onnx
test/onnx/gemm_test.onnx
+0
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+32
-0
No files found.
src/onnx/onnx.cpp
View file @
40dcfa6b
...
...
@@ -391,7 +391,7 @@ struct onnx_parser
}
if
(
contains
(
attributes
,
"beta"
))
{
alph
a
=
parse_value
(
attributes
.
at
(
"beta"
)).
at
<
float
>
();
bet
a
=
parse_value
(
attributes
.
at
(
"beta"
)).
at
<
float
>
();
}
if
(
contains
(
attributes
,
"transA"
))
{
...
...
test/onnx/add_scalar_test.onnx
0 → 100644
View file @
40dcfa6b
File added
test/onnx/gemm_test.onnx
0 → 100644
View file @
40dcfa6b
File added
test/onnx/onnx_test.cpp
View file @
40dcfa6b
...
...
@@ -421,6 +421,36 @@ void constant_test()
EXPECT
(
p
==
prog
);
}
void
gemm_test
()
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
5
,
7
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
11
,
5
}});
auto
l2
=
p
.
add_parameter
(
"2"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{}});
auto
t0
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l0
);
auto
t1
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
1
,
0
}},
l1
);
auto
d0
=
p
.
add_instruction
(
migraphx
::
op
::
dot
{
2
,
2
},
t0
,
t1
);
auto
b0
=
p
.
add_instruction
(
migraphx
::
op
::
broadcast
{
1
,
d0
->
get_shape
()},
l2
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
d0
,
b0
);
auto
prog
=
migraphx
::
parse_onnx
(
"gemm_test.onnx"
);
EXPECT
(
p
==
prog
);
}
void
add_scalar_test
()
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}});
auto
l1
=
p
.
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
}},
{
1
}});
auto
m0
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
0
,
0
,
0
,
5
}},
l0
);
auto
m1
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
0
,
0
,
0
,
5
}},
l1
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
m0
,
m1
);
auto
prog
=
migraphx
::
parse_onnx
(
"add_scalar_test.onnx"
);
EXPECT
(
p
==
prog
);
}
int
main
()
{
pytorch_conv_bias_test
();
...
...
@@ -454,4 +484,6 @@ int main()
concat_test
();
slice_test
();
constant_test
();
gemm_test
();
add_scalar_test
();
}
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