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
b5a02fea
Commit
b5a02fea
authored
Nov 07, 2022
by
Brian Pickrell
Browse files
sample of onnx test, not implemented
parent
4166593f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+13
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+16
-0
No files found.
test/onnx/gen_onnx.py
View file @
b5a02fea
...
@@ -44,6 +44,7 @@ def onnx_test(op_test):
...
@@ -44,6 +44,7 @@ def onnx_test(op_test):
op_info
[
1
],
op_info
[
2
])
op_info
[
1
],
op_info
[
2
])
model_def
=
helper
.
make_model
(
graph_def
,
model_def
=
helper
.
make_model
(
graph_def
,
producer_name
=
op_test
.
__name__
)
producer_name
=
op_test
.
__name__
)
print
(
'hello'
,
op_test
.
__name__
)
onnx
.
save
(
model_def
,
'{}.onnx'
.
format
(
op_test
.
__name__
))
onnx
.
save
(
model_def
,
'{}.onnx'
.
format
(
op_test
.
__name__
))
return
run_test
return
run_test
...
@@ -4451,6 +4452,18 @@ def reducel1_test():
...
@@ -4451,6 +4452,18 @@ def reducel1_test():
return
([
node
],
[
x
],
[
y
])
return
([
node
],
[
x
],
[
y
])
def
reducel1_dyn_test
():
x
=
helper
.
make_tensor_value_info
(
'x'
,
TensorProto
.
FLOAT
,
[
None
])
y
=
helper
.
make_tensor_value_info
(
'y'
,
TensorProto
.
FLOAT
,
[
None
])
axes
=
[
-
2
]
node
=
onnx
.
helper
.
make_node
(
'ReduceL1_dyn'
,
inputs
=
[
'x'
],
outputs
=
[
'y'
],
axes
=
axes
,
keepdims
=
0
)
return
([
node
],
[
x
],
[
y
])
@
onnx_test
@
onnx_test
def
reducel2_test
():
def
reducel2_test
():
...
...
test/onnx/onnx_test.cpp
View file @
b5a02fea
...
@@ -4241,6 +4241,22 @@ TEST_CASE(reducel1_test)
...
@@ -4241,6 +4241,22 @@ TEST_CASE(reducel1_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
reducel1_dyn_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
// a shape with 4 dynamic dimensions
auto
l0
=
mm
->
add_parameter
(
"x"
,
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"
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
reducel2_test
)
TEST_CASE
(
reducel2_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
...
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