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
7211c277
Commit
7211c277
authored
Nov 06, 2019
by
Cody Hao Yu
Committed by
Leyuan Wang
Nov 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TOPI] Fix bug in Winograd on CUDA (#4260)
* fix winograd * move get padding after kernel transform
parent
ddaa9530
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
topi/python/topi/cuda/conv2d_winograd.py
+16
-14
topi/tests/python/common.py
+1
-0
topi/tests/python/test_topi_conv2d_winograd.py
+1
-0
No files found.
topi/python/topi/cuda/conv2d_winograd.py
View file @
7211c277
...
...
@@ -17,6 +17,7 @@
# pylint: disable=invalid-name,unused-variable,unused-argument
"""Winograd template for cuda backend"""
import
logging
import
tvm
from
tvm
import
autotvm
...
...
@@ -27,6 +28,8 @@ from ..generic import schedule_conv2d_winograd_without_weight_transform
from
..nn.winograd_util
import
winograd_transform_matrices
logger
=
logging
.
getLogger
(
'conv2d_winograd'
)
def
_infer_tile_size
(
data
,
kernel
):
N
,
CI
,
H
,
W
=
get_const_tuple
(
data
.
shape
)
...
...
@@ -42,26 +45,25 @@ def winograd_cuda(cfg, data, kernel, strides, padding, dilation, layout, out_dty
N
,
CI
,
H
,
W
=
get_const_tuple
(
data
.
shape
)
if
isinstance
(
dilation
,
int
):
dilation_h
=
dilation_w
=
dilation
else
:
dilation_h
,
dilation_w
=
dilation
HSTR
,
WSTR
=
(
strides
,
strides
)
if
isinstance
(
strides
,
int
)
else
strides
if
not
pre_computed
:
# kernel tensor is raw tensor, do strict check
if
isinstance
(
dilation
,
int
):
dilation_h
=
dilation_w
=
dilation
else
:
dilation_h
,
dilation_w
=
dilation
if
dilation_h
!=
1
or
dilation_w
!=
1
:
kernel
=
dilate
(
kernel
,
(
1
,
1
,
dilation_h
,
dilation_w
))
kernel
=
dilation
(
kernel
,
(
1
,
1
,
dilation_h
,
dilation_w
))
CO
,
CI
,
KH
,
KW
=
get_const_tuple
(
kernel
.
shape
)
HPAD
,
WPAD
,
_
,
_
=
nn
.
get_pad_tuple
(
padding
,
kernel
)
HSTR
,
WSTR
=
(
strides
,
strides
)
if
isinstance
(
strides
,
int
)
else
strides
assert
HSTR
==
1
and
WSTR
==
1
and
KH
==
KW
else
:
# kernel tensor is pre-transfomred. this op is created by
# alter op layout, do not check
else
:
# kernel tensor is pre-transfomred. this op is created by alter op layout.
# dilation is not supported
HSTR
=
WSTR
=
1
HPAD
=
WPAD
=
1
KH
=
KW
=
3
_
,
_
,
CI
,
CO
=
get_const_tuple
(
kernel
.
shape
)
KH
=
KW
=
3
assert
HSTR
==
1
and
WSTR
==
1
and
dilation_h
==
1
and
dilation_w
==
1
HPAD
,
WPAD
,
_
,
_
=
nn
.
get_pad_tuple
(
padding
,
kernel
)
data_pad
=
nn
.
pad
(
data
,
(
0
,
0
,
HPAD
,
WPAD
),
(
0
,
0
,
HPAD
,
WPAD
),
name
=
"data_pad"
)
r
=
KW
...
...
@@ -384,7 +386,7 @@ def _alter_conv2d_layout(attrs, inputs, tinfos, F):
return
F
.
nn
.
conv2d
(
*
copy_inputs
,
**
new_attrs
)
if
attrs
.
get_int_tuple
(
"dilation"
)
!=
(
1
,
1
):
warnings
.
warn
(
"Does not support weight pre-transform for dilated convolution."
)
logger
.
warning
(
"Does not support weight pre-transform for dilated convolution."
)
return
None
# pre-compute weight transformation in winograd
...
...
topi/tests/python/common.py
View file @
7211c277
...
...
@@ -40,4 +40,5 @@ class Int8Fallback(autotvm.FallbackContext):
cfg
=
FallbackConfigEntity
()
cfg
.
template_key
=
'int8'
self
.
memory
[
key
]
=
cfg
cfg
.
is_fallback
=
False
return
cfg
topi/tests/python/test_topi_conv2d_winograd.py
View file @
7211c277
...
...
@@ -99,6 +99,7 @@ class WinogradFallback(autotvm.FallbackContext):
cfg
=
FallbackConfigEntity
()
cfg
.
template_key
=
'winograd'
self
.
memory
[
key
]
=
cfg
cfg
.
is_fallback
=
False
return
cfg
...
...
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