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
7ede2b3b
Commit
7ede2b3b
authored
Mar 12, 2019
by
Paul
Browse files
Merge branch 'develop' into stream_execution_checkin
parents
4de549d9
fa38a3a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+6
-1
src/tf/tf.cpp
src/tf/tf.cpp
+1
-1
test/onnx/no_pad_test.onnx
test/onnx/no_pad_test.onnx
+0
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+10
-0
No files found.
src/onnx/onnx.cpp
View file @
7ede2b3b
...
...
@@ -157,7 +157,7 @@ struct onnx_parser
template
<
class
T
>
instruction_ref
add_broadcastable_binary_op
(
instruction_ref
arg0
,
instruction_ref
arg1
,
T
x
)
{
if
(
arg0
->
get_shape
()
!=
arg1
->
get_shape
())
if
(
arg0
->
get_shape
()
.
lens
()
!=
arg1
->
get_shape
()
.
lens
()
)
{
// Example:
// s0 = (3,2,4,5) and s1 = (2,1,1)
...
...
@@ -638,6 +638,11 @@ struct onnx_parser
auto
&&
pad_vals
=
attributes
[
"pads"
].
ints
();
pads
=
std
::
vector
<
int64_t
>
(
pad_vals
.
begin
(),
pad_vals
.
end
());
}
// check if padding is actually being done (at least one value is nonzero)
if
(
std
::
all_of
(
pads
.
begin
(),
pads
.
end
(),
[](
const
int
&
i
)
{
return
i
==
0
;
}))
{
return
prog
.
add_instruction
(
migraphx
::
op
::
identity
{},
args
.
front
());
}
if
(
contains
(
attributes
,
"value"
))
{
value
=
parse_value
(
attributes
.
at
(
"value"
)).
at
<
float
>
();
...
...
src/tf/tf.cpp
View file @
7ede2b3b
...
...
@@ -167,7 +167,7 @@ struct tf_parser
template
<
class
T
>
instruction_ref
add_broadcastable_binary_op
(
instruction_ref
arg0
,
instruction_ref
arg1
,
T
x
)
{
if
(
arg0
->
get_shape
()
!=
arg1
->
get_shape
())
if
(
arg0
->
get_shape
()
.
lens
()
!=
arg1
->
get_shape
()
.
lens
()
)
{
// Example:
// s0 = (3,2,4,5) and s1 = (2,1,1)
...
...
test/onnx/no_pad_test.onnx
0 → 100644
View file @
7ede2b3b
File added
test/onnx/onnx_test.cpp
View file @
7ede2b3b
...
...
@@ -683,4 +683,14 @@ TEST_CASE(logsoftmax)
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
no_pad_test
)
{
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
2
}});
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
l0
);
auto
prog
=
migraphx
::
parse_onnx
(
"no_pad_test.onnx"
);
EXPECT
(
p
==
prog
);
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
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