Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
2dbe6261
Unverified
Commit
2dbe6261
authored
Apr 25, 2020
by
Thomas Viehmann
Committed by
GitHub
Apr 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix miopen pad (#5433)
parent
83930a3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
python/tvm/relay/op/strategy/rocm.py
+3
-1
topi/python/topi/rocm/conv2d.py
+3
-3
No files found.
python/tvm/relay/op/strategy/rocm.py
View file @
2dbe6261
...
@@ -36,6 +36,7 @@ def conv2d_strategy_rocm(attrs, inputs, out_type, target):
...
@@ -36,6 +36,7 @@ def conv2d_strategy_rocm(attrs, inputs, out_type, target):
layout
=
attrs
.
data_layout
layout
=
attrs
.
data_layout
stride_h
,
stride_w
=
attrs
.
get_int_tuple
(
"strides"
)
stride_h
,
stride_w
=
attrs
.
get_int_tuple
(
"strides"
)
kernel_layout
=
attrs
.
kernel_layout
kernel_layout
=
attrs
.
kernel_layout
padding
=
attrs
.
get_int_tuple
(
"padding"
)
if
dilation_h
<
1
or
dilation_w
<
1
:
if
dilation_h
<
1
or
dilation_w
<
1
:
raise
ValueError
(
"dilation should be positive value"
)
raise
ValueError
(
"dilation should be positive value"
)
...
@@ -77,7 +78,8 @@ def conv2d_strategy_rocm(attrs, inputs, out_type, target):
...
@@ -77,7 +78,8 @@ def conv2d_strategy_rocm(attrs, inputs, out_type, target):
else
:
else
:
raise
RuntimeError
(
"Unsupported conv2d layout {} for CUDA"
.
format
(
layout
))
raise
RuntimeError
(
"Unsupported conv2d layout {} for CUDA"
.
format
(
layout
))
# add miopen implementation
# add miopen implementation
if
"miopen"
in
target
.
libs
and
layout
==
"NCHW"
:
if
"miopen"
in
target
.
libs
and
layout
==
"NCHW"
and
padding
[
0
]
==
padding
[
2
]
and
\
padding
[
1
]
==
padding
[
3
]:
strategy
.
add_implementation
(
strategy
.
add_implementation
(
wrap_compute_conv2d
(
topi
.
rocm
.
conv2d_nchw_miopen
,
True
),
wrap_compute_conv2d
(
topi
.
rocm
.
conv2d_nchw_miopen
,
True
),
wrap_topi_schedule
(
topi
.
rocm
.
schedule_conv2d_nchw_miopen
),
wrap_topi_schedule
(
topi
.
rocm
.
schedule_conv2d_nchw_miopen
),
...
...
topi/python/topi/rocm/conv2d.py
View file @
2dbe6261
...
@@ -66,7 +66,7 @@ def conv2d_nchw_miopen(cfg, data, kernel, strides, padding, dilation,
...
@@ -66,7 +66,7 @@ def conv2d_nchw_miopen(cfg, data, kernel, strides, padding, dilation,
pt
,
pl
,
pb
,
pr
=
get_pad_tuple
(
padding
,
(
KH
,
KW
))
pt
,
pl
,
pb
,
pr
=
get_pad_tuple
(
padding
,
(
KH
,
KW
))
pad_h
,
pad_w
=
pt
+
pb
,
pl
+
pr
pad_h
,
pad_w
=
pt
+
pb
,
pl
+
pr
dilation_h
,
dilation_w
=
(
dilation
,
dilation
)
if
isinstance
(
dilation
,
int
)
else
dilation
dilation_h
,
dilation_w
=
(
dilation
,
dilation
)
if
isinstance
(
dilation
,
int
)
else
dilation
assert
(
pt
==
pb
)
and
(
pl
==
pr
)
OH
=
(
H
+
2
*
pad_h
-
KH
)
//
stride_h
+
1
OH
=
(
H
+
2
*
pad_h
-
KH
)
//
stride_h
+
1
OW
=
(
W
+
2
*
pad_w
-
KW
)
//
stride_w
+
1
OW
=
(
W
+
2
*
pad_w
-
KW
)
//
stride_w
+
1
cfg
.
add_flop
(
2
*
N
*
OH
*
OW
*
CO
*
CI
*
((
KH
-
1
)
*
dilation_h
+
1
)
*
\
cfg
.
add_flop
(
2
*
N
*
OH
*
OW
*
CO
*
CI
*
((
KH
-
1
)
*
dilation_h
+
1
)
*
\
...
@@ -76,8 +76,8 @@ def conv2d_nchw_miopen(cfg, data, kernel, strides, padding, dilation,
...
@@ -76,8 +76,8 @@ def conv2d_nchw_miopen(cfg, data, kernel, strides, padding, dilation,
kernel
,
kernel
,
stride_h
,
stride_h
,
stride_w
,
stride_w
,
p
ad_h
,
p
t
,
p
ad_w
,
p
l
,
dilation_h
,
dilation_h
,
dilation_w
,
dilation_w
,
conv_mode
=
0
,
conv_mode
=
0
,
...
...
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