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
01ff5321
Unverified
Commit
01ff5321
authored
Aug 27, 2019
by
mvermeulen
Committed by
GitHub
Aug 27, 2019
Browse files
Merge pull request #345 from ROCmSoftwarePlatform/onnx_autopad_fix
change condition for autopad to fail
parents
4085af9b
2fdf510d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+6
-2
test/onnx/conv_autopad_fail_test.onnx
test/onnx/conv_autopad_fail_test.onnx
+0
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+5
-0
No files found.
src/onnx/onnx.cpp
View file @
01ff5321
...
@@ -323,7 +323,11 @@ struct onnx_parser
...
@@ -323,7 +323,11 @@ struct onnx_parser
{
{
if
(
contains
(
attributes
,
"auto_pad"
))
if
(
contains
(
attributes
,
"auto_pad"
))
{
{
MIGRAPHX_THROW
(
"auto_pad and padding cannot be specified simultaneously"
);
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"
);
}
}
}
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
));
...
@@ -371,7 +375,7 @@ struct onnx_parser
...
@@ -371,7 +375,7 @@ struct onnx_parser
if
(
args
.
size
()
==
3
)
if
(
args
.
size
()
==
3
)
{
{
uint64_t
axis
=
1
;
uint64_t
axis
=
1
;
auto
l1
=
prog
.
add_instruction
(
op
,
args
[
0
]
,
args
[
1
]);
auto
l1
=
prog
.
add_instruction
(
op
,
l0
,
args
[
1
]);
auto
l2
=
prog
.
add_instruction
(
op
::
broadcast
{
axis
,
l1
->
get_shape
().
lens
()},
args
[
2
]);
auto
l2
=
prog
.
add_instruction
(
op
::
broadcast
{
axis
,
l1
->
get_shape
().
lens
()},
args
[
2
]);
return
prog
.
add_instruction
(
op
::
add
{},
l1
,
l2
);
return
prog
.
add_instruction
(
op
::
add
{},
l1
,
l2
);
}
}
...
...
test/onnx/conv_autopad_fail_test.onnx
0 → 100644
View file @
01ff5321
File added
test/onnx/onnx_test.cpp
View file @
01ff5321
...
@@ -8,6 +8,11 @@
...
@@ -8,6 +8,11 @@
#include <migraphx/onnx.hpp>
#include <migraphx/onnx.hpp>
#include "test.hpp"
#include "test.hpp"
TEST_CASE
(
conv_autopad_fail_test
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"conv_autopad_fail_test.onnx"
);
}));
}
TEST_CASE
(
pytorch_conv_bias_test
)
TEST_CASE
(
pytorch_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