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
68b68f44
Commit
68b68f44
authored
Jan 08, 2019
by
Khalique
Browse files
fix onnx tests
parent
cce2d317
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+2
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+7
-8
No files found.
src/onnx/onnx.cpp
View file @
68b68f44
...
...
@@ -412,6 +412,8 @@ struct onnx_parser
{
auto
l3
=
prog
.
add_instruction
(
op
::
dot
{
alpha
},
l1
,
l2
);
auto
l4
=
args
[
2
];
if
(
l4
->
get_shape
().
scalar
())
// ignore args[2] (no C value added to alpha*A*B)
return
l3
;
if
(
beta
!=
1.
f
)
{
auto
beta_val
=
prog
.
add_literal
(
beta
);
...
...
test/onnx/onnx_test.cpp
View file @
68b68f44
...
...
@@ -351,8 +351,8 @@ TEST_CASE(implicit_bcast_test)
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}});
auto
l2
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
0
,
0
,
4
,
5
}},
l0
);
auto
l3
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
0
,
0
,
4
,
5
}},
l1
);
auto
l2
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
2
,
3
,
4
,
5
}},
l0
);
auto
l3
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
2
,
3
,
4
,
5
}},
l1
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l2
,
l3
);
auto
prog
=
migraphx
::
parse_onnx
(
"implicit_bcast_test.onnx"
);
...
...
@@ -460,12 +460,11 @@ TEST_CASE(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
,
{}});
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
alpha
=
2.
f
;
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
},
t0
,
t1
);
auto
prog
=
migraphx
::
parse_onnx
(
"gemm_test.onnx"
);
EXPECT
(
p
==
prog
);
...
...
@@ -477,8 +476,8 @@ TEST_CASE(add_scalar_test)
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
);
auto
m0
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
2
,
3
,
4
,
5
}},
l0
);
auto
m1
=
p
.
add_instruction
(
migraphx
::
op
::
multibroadcast
{{
2
,
3
,
4
,
5
}},
l1
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
m0
,
m1
);
auto
prog
=
migraphx
::
parse_onnx
(
"add_scalar_test.onnx"
);
...
...
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