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
68472596
Commit
68472596
authored
Oct 14, 2019
by
Animesh Jain
Committed by
Zhi
Oct 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Relay][Topi] Disable conv NHWC pack int8. (#4038)
parent
481b9c49
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
tests/python/relay/test_backend_compile_engine.py
+16
-0
topi/python/topi/x86/conv2d.py
+9
-6
No files found.
tests/python/relay/test_backend_compile_engine.py
View file @
68472596
...
...
@@ -93,9 +93,25 @@ def test_compile_full():
relay
.
build
(
mod
,
'llvm'
)
def
test_compile_nhwc_pack
():
data
=
relay
.
var
(
"data"
,
shape
=
(
1
,
1
,
1
,
1024
),
dtype
=
"uint8"
)
weight
=
relay
.
var
(
"weight"
,
shape
=
(
1
,
1
,
1024
,
1001
),
dtype
=
"int8"
)
p2
=
relay
.
var
(
"p2"
,
shape
=
(
1
,
1
,
1
,
1
),
dtype
=
"int32"
)
conv
=
relay
.
nn
.
conv2d
(
data
,
weight
,
kernel_size
=
(
1
,
1
),
data_layout
=
"NHWC"
,
kernel_layout
=
"HWIO"
,
out_dtype
=
"int32"
)
multiply
=
relay
.
multiply
(
relay
.
const
(
-
22
,
dtype
=
'int32'
),
p2
)
tile
=
relay
.
tile
(
multiply
,
reps
=
(
1
,
1
,
1
,
1001
))
subtract
=
relay
.
subtract
(
conv
,
tile
)
func
=
subtract
mod
=
relay
.
Function
(
relay
.
analysis
.
free_vars
(
func
),
func
)
relay
.
build
(
mod
,
target
=
"llvm"
)
if
__name__
==
"__main__"
:
test_compile_engine
()
test_compile_placeholder_bypass
()
test_compile_injective_with_tuple
()
test_compile_tuple_dup
()
test_compile_full
()
test_compile_nhwc_pack
()
topi/python/topi/x86/conv2d.py
View file @
68472596
...
...
@@ -110,12 +110,15 @@ def _declaration_conv(cfg, data, kernel, strides, padding, dilation, layout, out
kh
,
kw
,
_
,
_
=
get_const_tuple
(
kernel
.
shape
)
if
layout
==
'HWCN'
:
return
nn
.
conv2d_hwcn
(
data
,
kernel
,
strides
,
padding
,
dilation
,
out_dtype
)
elif
layout
==
'NHWC'
and
kh
==
1
and
kw
==
1
and
kernel
.
dtype
==
"int8"
:
if
cfg
.
is_fallback
:
_get_default_config
(
cfg
,
data
,
kernel
,
strides
,
padding
,
out_dtype
,
False
,
layout
)
# specialize for INT8 1X1 conv on X86
return
conv2d_avx_1x1
.
_declaration_conv_nhwc_pack
(
cfg
,
data
,
kernel
,
strides
,
padding
,
dilation
,
out_dtype
)
# FIXME - https://github.com/dmlc/tvm/issues/4122
# _declaration_conv_nhwc_pack expects kernel layout to be HWOI. However, the tests use HWIO
# layout. Commenting until we have clarity about the nhwc_pack implementation from the author.
# elif layout == 'NHWC' and kh == 1 and kw == 1 and kernel.dtype == "int8":
# if cfg.is_fallback:
# _get_default_config(cfg, data, kernel, strides, padding, out_dtype, False, layout)
# # specialize for INT8 1X1 conv on X86
# return conv2d_avx_1x1._declaration_conv_nhwc_pack(cfg, data, kernel, strides,
# padding, dilation, out_dtype)
elif
layout
==
'NHWC'
:
return
nn
.
conv2d_nhwc
(
data
,
kernel
,
strides
,
padding
,
dilation
,
out_dtype
)
raise
ValueError
(
"not support this layout {} yet"
.
format
(
layout
))
...
...
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