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
99ff9af8
Commit
99ff9af8
authored
Dec 01, 2022
by
Brian Pickrell
Browse files
Fixed onnx test to use dynamic squeeze op and added a second onnx test for reduce ops.
parent
13ea6f19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+16
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+24
-2
test/onnx/reducemax_dyn_test.onnx
test/onnx/reducemax_dyn_test.onnx
+0
-0
No files found.
test/onnx/gen_onnx.py
View file @
99ff9af8
...
...
@@ -4569,6 +4569,22 @@ def reduce_log_sum_exp_test():
def
reducemax_test
():
x
=
helper
.
make_tensor_value_info
(
'x'
,
TensorProto
.
FLOAT
,
[
3
,
4
,
5
,
6
])
y
=
helper
.
make_tensor_value_info
(
'y'
,
TensorProto
.
FLOAT
,
[
3
,
4
,
6
])
axes
=
[
2
]
node
=
onnx
.
helper
.
make_node
(
'ReduceMax'
,
inputs
=
[
'x'
],
outputs
=
[
'y'
],
axes
=
axes
,
keepdims
=
0
)
return
([
node
],
[
x
],
[
y
])
@
onnx_test
def
reducemax_dyn_test
():
x
=
helper
.
make_tensor_value_info
(
'x'
,
TensorProto
.
FLOAT
,
[
None
,
4
,
5
,
6
])
y
=
helper
.
make_tensor_value_info
(
'y'
,
TensorProto
.
FLOAT
,
[
3
,
4
,
6
])
axes
=
[
2
]
node
=
onnx
.
helper
.
make_node
(
'ReduceMax'
,
...
...
test/onnx/onnx_test.cpp
View file @
99ff9af8
...
...
@@ -4321,8 +4321,12 @@ TEST_CASE(reducel1_dyn_test)
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
3
,
3
,
0
},
{
3
,
5
,
0
},
{
4
,
6
,
5
},
{
5
,
7
,
6
}}});
auto
abs_l0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"abs"
),
l0
);
auto
sum_l0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_sum"
,
{{
"axes"
,
{
-
2
}}}),
abs_l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
-
2
}}}),
sum_l0
);
auto
prog
=
optimize_onnx
(
"reducel1_dyn_test.onnx"
);
auto
sq_l0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
-
2
}}}),
sum_l0
);
mm
->
add_return
({
sq_l0
});
migraphx
::
onnx_options
options
;
options
.
map_dyn_input_dims
[
"x"
]
=
{{
3
,
3
},
{
3
,
5
},
{
4
,
6
,
5
},
{
5
,
7
,
6
}};
auto
prog
=
migraphx
::
parse_onnx
(
"reducel1_dyn_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
...
...
@@ -4377,6 +4381,24 @@ TEST_CASE(reducemax_test)
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
reducemax_dyn_test
)
{
// input shape with 4 dynamic dimensions
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
3
,
3
},
{
4
,
4
},
{
5
,
5
},
{
6
,
6
}}});
auto
r0
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_max"
,
{{
"axes"
,
{
2
}}}),
l0
);
auto
r1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"squeeze"
,
{{
"axes"
,
{
2
}}}),
r0
);
mm
->
add_return
({
r1
});
migraphx
::
onnx_options
options
;
options
.
map_dyn_input_dims
[
"x"
]
=
{{
3
,
3
},
{
4
,
4
},
{
5
,
5
},
{
6
,
6
}};
auto
prog
=
migraphx
::
parse_onnx
(
"reducemax_dyn_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
reducemean_test
)
{
migraphx
::
program
p
;
...
...
test/onnx/reducemax_dyn_test.onnx
0 → 100644
View file @
99ff9af8
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