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
272bce63
Commit
272bce63
authored
Aug 22, 2019
by
Khalique
Browse files
added more onnx tests
parent
86663aa5
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
56 additions
and
34 deletions
+56
-34
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+34
-34
test/onnx/pow_test.onnx
test/onnx/pow_test.onnx
+22
-0
test/onnx/reducemean_keepdims_test.onnx
test/onnx/reducemean_keepdims_test.onnx
+0
-0
test/onnx/reducemean_test.onnx
test/onnx/reducemean_test.onnx
+0
-0
test/onnx/reducesum_keepdims_test.onnx
test/onnx/reducesum_keepdims_test.onnx
+0
-0
test/onnx/reducesum_multiaxis_test.onnx
test/onnx/reducesum_multiaxis_test.onnx
+0
-0
test/onnx/reducesum_test.onnx
test/onnx/reducesum_test.onnx
+0
-0
test/onnx/reshape_non_standard_test.onnx
test/onnx/reshape_non_standard_test.onnx
+0
-0
test/onnx/shape_gather_test.onnx
test/onnx/shape_gather_test.onnx
+0
-0
No files found.
test/onnx/onnx_test.cpp
View file @
272bce63
...
@@ -143,29 +143,29 @@ TEST_CASE(constant_test)
...
@@ -143,29 +143,29 @@ TEST_CASE(constant_test)
TEST_CASE
(
constant_fill_test
)
TEST_CASE
(
constant_fill_test
)
{
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_literal
(
migraphx
::
literal
{
{
migraphx
::
shape
::
int32
_type
,
{
2
}},
{
2
,
3
}}
)
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float
_type
,
{
2
,
3
}};
std
::
vector
<
std
::
size_t
>
dims
(
l0
->
get_shap
e
(
)
.
elements
());
std
::
vector
<
float
>
valu
e
(
s
.
elements
()
,
1.0
);
migraphx
::
literal
ls
=
l0
->
get_literal
(
);
p
.
add_literal
(
migraphx
::
literal
{
s
,
value
}
);
ls
.
visit
([
&
](
auto
s
)
{
dims
.
assign
(
s
.
begin
(),
s
.
end
());
}
);
auto
prog
=
migraphx
::
parse_onnx
(
"constant_fill_test.onnx"
);
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
dims
};
std
::
vector
<
float
>
value
(
s
.
elements
(),
1.0
);
EXPECT
(
p
==
prog
);
p
.
add_literal
(
migraphx
::
literal
{
s
,
value
});
}
auto
prog
=
migraphx
::
parse_onnx
(
"const_fill1_test.onnx"
);
TEST_CASE
(
constant_fill_input_as_shape_test
)
EXPECT
(
p
==
prog
);
{
}
migraphx
::
program
p
;
auto
l0
=
p
.
add_literal
(
migraphx
::
literal
{{
migraphx
::
shape
::
int32_type
,
{
2
}},
{
2
,
3
}});
{
std
::
vector
<
std
::
size_t
>
dims
(
l0
->
get_shape
().
elements
());
migraphx
::
program
p
;
migraphx
::
literal
ls
=
l0
->
get_literal
()
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}}
;
ls
.
visit
([
&
](
auto
s
)
{
dims
.
assign
(
s
.
begin
(),
s
.
end
());
})
;
std
::
vector
<
float
>
value
(
s
.
elements
(),
1.0
)
;
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
dims
}
;
p
.
add_literal
(
migraphx
::
literal
{
s
,
value
}
);
std
::
vector
<
float
>
value
(
s
.
elements
(),
1.0
);
auto
prog
=
migraphx
::
parse_onnx
(
"const_fill2_test.onnx"
);
p
.
add_literal
(
migraphx
::
literal
{
s
,
value
}
);
auto
prog
=
migraphx
::
parse_onnx
(
"constant_fill_input_as_shape_test.onnx"
);
EXPECT
(
p
==
prog
);
}
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
constant_scalar_test
)
TEST_CASE
(
constant_scalar_test
)
...
@@ -358,7 +358,7 @@ TEST_CASE(gemm_ex_test)
...
@@ -358,7 +358,7 @@ TEST_CASE(gemm_ex_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
gemm_ex_brcst
)
TEST_CASE
(
gemm_ex_brcst
_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
6
}});
auto
l0
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
5
,
6
}});
...
@@ -370,7 +370,7 @@ TEST_CASE(gemm_ex_brcst)
...
@@ -370,7 +370,7 @@ TEST_CASE(gemm_ex_brcst)
auto
alpha
=
0.5
f
;
auto
alpha
=
0.5
f
;
auto
beta
=
0.8
f
;
auto
beta
=
0.8
f
;
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
t0
,
l1
,
t2
);
p
.
add_instruction
(
migraphx
::
op
::
dot
{
alpha
,
beta
},
t0
,
l1
,
t2
);
auto
prog
=
migraphx
::
parse_onnx
(
"gemm_test
_ex1
.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"gemm_
ex_brcst_
test.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
...
@@ -772,34 +772,34 @@ TEST_CASE(reducemean_keepdims_test)
...
@@ -772,34 +772,34 @@ TEST_CASE(reducemean_keepdims_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
reducesum_test
1
)
TEST_CASE
(
reducesum_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l0
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l1
=
p
.
add_instruction
(
migraphx
::
op
::
reduce_sum
{{
2
}},
l0
);
auto
l1
=
p
.
add_instruction
(
migraphx
::
op
::
reduce_sum
{{
2
}},
l0
);
p
.
add_instruction
(
migraphx
::
op
::
squeeze
{{
2
}},
l1
);
p
.
add_instruction
(
migraphx
::
op
::
squeeze
{{
2
}},
l1
);
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_test
1
.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_test.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
reducesum_test
2
)
TEST_CASE
(
reducesum_
multiaxis_
test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l0
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l1
=
p
.
add_instruction
(
migraphx
::
op
::
reduce_sum
{{
2
,
3
}},
l0
);
auto
l1
=
p
.
add_instruction
(
migraphx
::
op
::
reduce_sum
{{
2
,
3
}},
l0
);
p
.
add_instruction
(
migraphx
::
op
::
squeeze
{{
2
,
3
}},
l1
);
p
.
add_instruction
(
migraphx
::
op
::
squeeze
{{
2
,
3
}},
l1
);
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_test
2
.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_
multiaxis_
test.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
reducesum_test
3
)
TEST_CASE
(
reducesum_
keepdims_
test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l0
=
p
.
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
p
.
add_instruction
(
migraphx
::
op
::
reduce_sum
{{
2
,
3
}},
l0
);
p
.
add_instruction
(
migraphx
::
op
::
reduce_sum
{{
2
,
3
}},
l0
);
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_test
3
.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"reducesum_
keepdims_
test.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
...
@@ -820,7 +820,7 @@ TEST_CASE(reshape_test)
...
@@ -820,7 +820,7 @@ TEST_CASE(reshape_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
reshape_non_standard
)
TEST_CASE
(
reshape_non_standard
_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
migraphx
::
op
::
reshape
op
;
migraphx
::
op
::
reshape
op
;
...
@@ -830,7 +830,7 @@ TEST_CASE(reshape_non_standard)
...
@@ -830,7 +830,7 @@ TEST_CASE(reshape_non_standard)
auto
tran_x
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
2
,
1
}},
x
);
auto
tran_x
=
p
.
add_instruction
(
migraphx
::
op
::
transpose
{{
0
,
2
,
1
}},
x
);
auto
cont_x
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
tran_x
);
auto
cont_x
=
p
.
add_instruction
(
migraphx
::
op
::
contiguous
{},
tran_x
);
p
.
add_instruction
(
migraphx
::
op
::
reshape
{{
4
,
3
,
2
}},
cont_x
);
p
.
add_instruction
(
migraphx
::
op
::
reshape
{{
4
,
3
,
2
}},
cont_x
);
auto
prog
=
migraphx
::
parse_onnx
(
"reshape_non_standard.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"reshape_non_standard
_test
.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
...
@@ -857,7 +857,7 @@ TEST_CASE(shape_gather_test)
...
@@ -857,7 +857,7 @@ TEST_CASE(shape_gather_test)
auto
l2
=
p
.
add_literal
(
migraphx
::
literal
{
const_shape
,
{
1
}});
auto
l2
=
p
.
add_literal
(
migraphx
::
literal
{
const_shape
,
{
1
}});
int
axis
=
0
;
int
axis
=
0
;
p
.
add_instruction
(
migraphx
::
op
::
gather
{
axis
},
l1
,
l2
);
p
.
add_instruction
(
migraphx
::
op
::
gather
{
axis
},
l1
,
l2
);
auto
prog
=
migraphx
::
parse_onnx
(
"shape_gather.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"shape_gather
_test
.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
...
...
test/onnx/pow_test.onnx
0 → 100644
View file @
272bce63
pow2:u
0
1out"Powpow_testZ
0
Z
1
b
out
B
test/onnx/reducemean_test
2
.onnx
→
test/onnx/reducemean_
keepdims_
test.onnx
View file @
272bce63
File moved
test/onnx/reducemean_test
1
.onnx
→
test/onnx/reducemean_test.onnx
View file @
272bce63
File moved
test/onnx/reducesum_test
3
.onnx
→
test/onnx/reducesum_
keepdims_
test.onnx
View file @
272bce63
File moved
test/onnx/reducesum_test
2
.onnx
→
test/onnx/reducesum_
multiaxis_
test.onnx
View file @
272bce63
No preview for this file type
test/onnx/reducesum_test
1
.onnx
→
test/onnx/reducesum_test.onnx
View file @
272bce63
File moved
test/onnx/reshape_non_standard.onnx
→
test/onnx/reshape_non_standard
_test
.onnx
View file @
272bce63
File moved
test/onnx/shape_gather.onnx
→
test/onnx/shape_gather
_test
.onnx
View file @
272bce63
File moved
Prev
1
2
Next
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