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
221503d7
Commit
221503d7
authored
Nov 02, 2022
by
charlie
Browse files
Add onnx tests
parent
0ff0839d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+20
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+21
-0
test/onnx/squeeze_unsqueeze_dyn_test.onnx
test/onnx/squeeze_unsqueeze_dyn_test.onnx
+0
-0
No files found.
test/onnx/gen_onnx.py
View file @
221503d7
...
...
@@ -5806,6 +5806,26 @@ def squeeze_unsqueeze_test():
return
([
node
,
node2
],
[
x
],
[
y
])
@
onnx_test
def
squeeze_unsqueeze_dyn_test
():
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
1
,
None
,
1
,
1
,
None
,
1
])
y
=
helper
.
make_tensor_value_info
(
'2'
,
TensorProto
.
FLOAT
,
[
1
,
1
,
None
,
1
,
None
,
1
])
node
=
onnx
.
helper
.
make_node
(
'Squeeze'
,
inputs
=
[
'0'
],
axes
=
[
0
,
2
,
3
,
5
],
outputs
=
[
'1'
])
node2
=
onnx
.
helper
.
make_node
(
'Unsqueeze'
,
inputs
=
[
'1'
],
axes
=
[
0
,
1
,
3
,
5
],
outputs
=
[
'2'
])
return
([
node
,
node2
],
[
x
],
[
y
])
@
onnx_test
def
sub_bcast_test
():
arg0
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
2
,
3
,
4
,
5
])
...
...
test/onnx/onnx_test.cpp
View file @
221503d7
...
...
@@ -5640,6 +5640,27 @@ TEST_CASE(squeeze_unsqueeze_test)
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
squeeze_unsqueeze_dyn_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
int64_t
>
squeeze_axes
{
0
,
2
,
3
,
5
};
std
::
vector
<
int64_t
>
unsqueeze_axes
{
0
,
1
,
3
,
5
};
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
1
,
1
,
0
},
{
1
,
4
,
0
},
{
1
,
1
,
0
},
{
1
,
1
,
1
},
{
1
,
4
,
0
},
{
1
,
1
,
0
}}});
auto
l1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
squeeze_axes
}}),
l0
);
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"unsqueeze"
,
{{
"axes"
,
unsqueeze_axes
}}),
l1
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
4
,
0
};
auto
prog
=
parse_onnx
(
"squeeze_unsqueeze_dyn_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
squeeze_axes_input_test
)
{
migraphx
::
program
p
;
...
...
test/onnx/squeeze_unsqueeze_dyn_test.onnx
0 → 100644
View file @
221503d7
File added
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