Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
8ded3a31
Commit
8ded3a31
authored
Aug 26, 2019
by
Khalique
Browse files
manual merge, add test
parents
b05e573d
3da18f30
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
1 deletion
+35
-1
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+5
-1
test/onnx/conv_autopad_fail_test.onnx
test/onnx/conv_autopad_fail_test.onnx
+0
-0
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+25
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+5
-0
No files found.
src/onnx/onnx.cpp
View file @
8ded3a31
...
@@ -312,9 +312,13 @@ struct onnx_parser
...
@@ -312,9 +312,13 @@ struct onnx_parser
if
(
contains
(
attributes
,
"pads"
))
if
(
contains
(
attributes
,
"pads"
))
{
{
if
(
contains
(
attributes
,
"auto_pad"
))
if
(
contains
(
attributes
,
"auto_pad"
))
{
auto
s
=
attributes
[
"auto_pad"
].
s
();
if
(
contains
(
attributes
,
"pads"
)
and
to_upper
(
s
)
!=
"NOTSET"
)
{
{
MIGRAPHX_THROW
(
"auto_pad and padding cannot be specified simultaneously"
);
MIGRAPHX_THROW
(
"auto_pad and padding cannot be specified simultaneously"
);
}
}
}
std
::
vector
<
std
::
int64_t
>
padding
;
std
::
vector
<
std
::
int64_t
>
padding
;
copy
(
attributes
[
"pads"
].
ints
(),
std
::
back_inserter
(
padding
));
copy
(
attributes
[
"pads"
].
ints
(),
std
::
back_inserter
(
padding
));
if
(
padding
.
size
()
!=
4
)
if
(
padding
.
size
()
!=
4
)
...
...
test/onnx/conv_autopad_fail_test.onnx
0 → 100644
View file @
8ded3a31
File added
test/onnx/gen_onnx.py
View file @
8ded3a31
...
@@ -502,6 +502,31 @@ def const_of_shape_no_value_attr_test():
...
@@ -502,6 +502,31 @@ def const_of_shape_no_value_attr_test():
model_def
=
helper
.
make_model
(
graph_def
,
producer_name
=
'constant-of-shape'
)
model_def
=
helper
.
make_model
(
graph_def
,
producer_name
=
'constant-of-shape'
)
onnx
.
save
(
model_def
,
'const_of_shape_no_value_attr_test.onnx'
)
onnx
.
save
(
model_def
,
'const_of_shape_no_value_attr_test.onnx'
)
def
conv_autopad_fail_test
():
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
1
,
3
,
32
,
32
])
y
=
helper
.
make_tensor_value_info
(
'1'
,
TensorProto
.
FLOAT
,
[
1
,
3
,
1
,
1
])
out
=
helper
.
make_tensor_value_info
(
'2'
,
TensorProto
.
FLOAT
,
[
1
,
1
,
34
,
34
])
node
=
onnx
.
helper
.
make_node
(
'Conv'
,
inputs
=
[
'0'
,
'1'
],
outputs
=
[
'2'
],
dilations
=
[
1
,
1
],
strides
=
[
1
,
1
],
auto_pad
=
'SAME'
,
pads
=
[
0
,
0
,
1
,
1
,
0
,
0
,
1
,
1
]
)
graph_def
=
helper
.
make_graph
(
[
node
],
'test_conv'
,
[
x
,
y
],
[
out
],
)
model_def
=
helper
.
make_model
(
graph_def
,
producer_name
=
'conv-example'
)
onnx
.
save
(
model_def
,
'conv_autopad_fail_test.onnx'
)
def
conv_bias_test
():
def
conv_bias_test
():
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
1
,
3
,
32
,
32
])
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
1
,
3
,
32
,
32
])
y
=
helper
.
make_tensor_value_info
(
'1'
,
TensorProto
.
FLOAT
,
[
1
,
3
,
5
,
5
])
y
=
helper
.
make_tensor_value_info
(
'1'
,
TensorProto
.
FLOAT
,
[
1
,
3
,
5
,
5
])
...
...
test/onnx/onnx_test.cpp
View file @
8ded3a31
...
@@ -228,6 +228,11 @@ TEST_CASE(const_of_shape_no_value_attr_test)
...
@@ -228,6 +228,11 @@ TEST_CASE(const_of_shape_no_value_attr_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
conv_autopad_fail_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"conv_autopad_fail_test.onnx"
);
}));
}
TEST_CASE
(
conv_bias_test
)
TEST_CASE
(
conv_bias_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