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
5f7f4ebc
Commit
5f7f4ebc
authored
Jun 25, 2021
by
Shucai Xiao
Browse files
add onnx unit tests
parent
814793ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+19
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+15
-0
test/onnx/scatter_test.onnx
test/onnx/scatter_test.onnx
+30
-0
No files found.
test/onnx/gen_onnx.py
View file @
5f7f4ebc
...
@@ -3285,6 +3285,25 @@ def resize_upsample_pc_test():
...
@@ -3285,6 +3285,25 @@ def resize_upsample_pc_test():
return
([
node
],
[
X
],
[
Y
],
[
scale_tensor
])
return
([
node
],
[
X
],
[
Y
],
[
scale_tensor
])
@
onnx_test
def
scatter_test
():
x
=
helper
.
make_tensor_value_info
(
'data'
,
TensorProto
.
FLOAT
,
[
3
,
4
,
5
,
6
])
i
=
helper
.
make_tensor_value_info
(
'indices'
,
TensorProto
.
INT32
,
[
2
,
3
,
4
,
5
])
u
=
helper
.
make_tensor_value_info
(
'update'
,
TensorProto
.
FLOAT
,
[
2
,
3
,
4
,
5
])
y
=
helper
.
make_tensor_value_info
(
'y'
,
TensorProto
.
FLOAT
,
[
3
,
4
,
5
,
6
])
node
=
onnx
.
helper
.
make_node
(
'Scatter'
,
inputs
=
[
'data'
,
'indices'
,
'update'
],
outputs
=
[
'y'
],
axis
=-
2
,
)
return
([
node
],
[
x
,
i
,
u
],
[
y
])
@
onnx_test
@
onnx_test
def
selu_test
():
def
selu_test
():
x
=
helper
.
make_tensor_value_info
(
'x'
,
TensorProto
.
DOUBLE
,
[
2
,
3
])
x
=
helper
.
make_tensor_value_info
(
'x'
,
TensorProto
.
DOUBLE
,
[
2
,
3
])
...
...
test/onnx/onnx_test.cpp
View file @
5f7f4ebc
...
@@ -3102,6 +3102,21 @@ TEST_CASE(round_test)
...
@@ -3102,6 +3102,21 @@ TEST_CASE(round_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
scatter_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"data"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
,
5
,
6
}});
auto
l1
=
mm
->
add_parameter
(
"indices"
,
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
3
,
4
,
5
}});
auto
l2
=
mm
->
add_parameter
(
"update"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}});
int
axis
=
-
2
;
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatter"
,
{{
"axis"
,
axis
}}),
l0
,
l1
,
l2
);
mm
->
add_return
({
r
});
auto
prog
=
migraphx
::
parse_onnx
(
"scatter_test.onnx"
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
selu_test
)
TEST_CASE
(
selu_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
...
test/onnx/scatter_test.onnx
0 → 100644
View file @
5f7f4ebc
scatter_test:
9
data
indices
updatey"Scatter*
axisscatter_testZ
data
Z!
indices
Z
update
b
y
B
\ No newline at end of file
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