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
78146d21
Commit
78146d21
authored
Mar 28, 2019
by
Khalique
Browse files
formatting
parent
d853f700
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
src/eliminate_pad.cpp
src/eliminate_pad.cpp
+1
-1
test/eliminate_pad_test.cpp
test/eliminate_pad_test.cpp
+5
-2
No files found.
src/eliminate_pad.cpp
View file @
78146d21
...
@@ -40,7 +40,7 @@ void eliminate_pad::update_op(T,
...
@@ -40,7 +40,7 @@ void eliminate_pad::update_op(T,
std
::
vector
<
int64_t
>
pads
=
pad_op
.
pads
;
std
::
vector
<
int64_t
>
pads
=
pad_op
.
pads
;
std
::
array
<
size_t
,
2
>
new_pads
{
static_cast
<
size_t
>
(
pads
[
2
]),
static_cast
<
size_t
>
(
pads
[
3
])};
std
::
array
<
size_t
,
2
>
new_pads
{
static_cast
<
size_t
>
(
pads
[
2
]),
static_cast
<
size_t
>
(
pads
[
3
])};
T
op
=
any_cast
<
T
>
(
ins
->
get_operator
());
T
op
=
any_cast
<
T
>
(
ins
->
get_operator
());
if
(
op
.
padding_mode
!=
op
::
padding_mode_t
::
default_
)
if
(
op
.
padding_mode
!=
op
::
padding_mode_t
::
default_
)
return
;
return
;
op
.
padding
=
new_pads
;
op
.
padding
=
new_pads
;
...
...
test/eliminate_pad_test.cpp
View file @
78146d21
...
@@ -27,7 +27,10 @@ create_im2col(migraphx::instruction_ref& l_img, size_t channels, migraphx::progr
...
@@ -27,7 +27,10 @@ create_im2col(migraphx::instruction_ref& l_img, size_t channels, migraphx::progr
}
}
migraphx
::
instruction_ref
migraphx
::
instruction_ref
create_conv
(
migraphx
::
instruction_ref
&
l_img
,
size_t
channels
,
migraphx
::
program
&
p
,
migraphx
::
op
::
padding_mode_t
padding_mode
=
migraphx
::
op
::
padding_mode_t
::
default_
)
create_conv
(
migraphx
::
instruction_ref
&
l_img
,
size_t
channels
,
migraphx
::
program
&
p
,
migraphx
::
op
::
padding_mode_t
padding_mode
=
migraphx
::
op
::
padding_mode_t
::
default_
)
{
{
migraphx
::
shape
s_weights
{
migraphx
::
shape
::
int32_type
,
{
4
,
channels
,
3
,
3
}};
migraphx
::
shape
s_weights
{
migraphx
::
shape
::
int32_type
,
{
4
,
channels
,
3
,
3
}};
std
::
vector
<
int32_t
>
weights
(
4
*
channels
*
3
*
3
);
std
::
vector
<
int32_t
>
weights
(
4
*
channels
*
3
*
3
);
...
@@ -91,7 +94,7 @@ TEST_CASE(rewrite_test_same_padding)
...
@@ -91,7 +94,7 @@ TEST_CASE(rewrite_test_same_padding)
migraphx
::
shape
s_img
{
migraphx
::
shape
::
int32_type
,
{
1
,
channels
,
img_dim
[
0
],
img_dim
[
1
]}};
migraphx
::
shape
s_img
{
migraphx
::
shape
::
int32_type
,
{
1
,
channels
,
img_dim
[
0
],
img_dim
[
1
]}};
auto
l_img
=
p
.
add_literal
(
migraphx
::
literal
{
s_img
,
input
});
auto
l_img
=
p
.
add_literal
(
migraphx
::
literal
{
s_img
,
input
});
auto
padded_img
=
p
.
add_instruction
(
migraphx
::
op
::
pad
{{
0
,
0
,
1
,
1
,
0
,
0
,
1
,
1
}},
l_img
);
auto
padded_img
=
p
.
add_instruction
(
migraphx
::
op
::
pad
{{
0
,
0
,
1
,
1
,
0
,
0
,
1
,
1
}},
l_img
);
create_conv
(
padded_img
,
channels
,
p
,
migraphx
::
op
::
padding_mode_t
::
same
);
create_conv
(
padded_img
,
channels
,
p
,
migraphx
::
op
::
padding_mode_t
::
same
);
p
.
compile
(
eliminate_pad_target
{});
p
.
compile
(
eliminate_pad_target
{});
...
...
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