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
56c50d2d
Commit
56c50d2d
authored
Aug 22, 2018
by
Lianmin Zheng
Committed by
Tianqi Chen
Aug 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trigger ci (#1620)
parent
c98ba601
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
topi/python/topi/x86/nn.py
+19
-24
No files found.
topi/python/topi/x86/nn.py
View file @
56c50d2d
...
...
@@ -2,8 +2,9 @@
"""x86 nn operators"""
from
__future__
import
absolute_import
as
_abs
import
tvm
from
..
import
generic
from
..
import
tag
from
..
util
import
traverse_inline
@generic.schedule_softmax.register
([
"cpu"
])
def
schedule_softmax
(
outs
):
...
...
@@ -53,44 +54,38 @@ def schedule_dense(outs):
outs
=
[
outs
]
if
isinstance
(
outs
,
tvm
.
tensor
.
Tensor
)
else
outs
s
=
tvm
.
create_schedule
([
x
.
op
for
x
in
outs
])
scheduled_ops
=
[]
def
traverse
(
op
):
"""Traverse operators from computation graph"""
# inline all one-to-one-mapping operators except the last stage (output)
if
tag
.
is_broadcast
(
op
.
tag
):
if
op
not
in
s
.
outputs
:
s
[
op
]
.
compute_inline
()
for
tensor
in
op
.
input_tensors
:
if
tensor
.
op
.
input_tensors
and
tensor
.
op
not
in
scheduled_ops
:
traverse
(
tensor
.
op
)
def
_callback
(
op
):
if
'dense'
in
op
.
tag
:
C
=
op
.
output
(
0
)
x
,
y
=
C
.
op
.
axis
output
=
outs
[
0
]
dense
=
op
.
output
(
0
)
# Write cache for blocks
CC
=
s
.
cache_write
(
C
,
'global'
)
if
dense
.
op
in
s
.
outputs
:
CC
=
s
.
cache_write
(
dense
,
'local'
)
else
:
CC
=
dense
# Tile
bnx
=
1
bny
=
4
_
,
yo
,
_
,
yi
=
s
[
C
]
.
tile
(
x
,
y
,
bnx
,
bny
)
s
[
CC
]
.
compute_at
(
s
[
C
],
yo
)
x
,
y
=
output
.
op
.
axis
xo
,
yo
,
xi
,
yi
=
s
[
output
]
.
tile
(
x
,
y
,
bnx
,
bny
)
xc
,
yc
=
s
[
CC
]
.
op
.
axis
k
,
=
s
[
CC
]
.
op
.
reduce_axis
ko
,
ki
=
s
[
CC
]
.
split
(
k
,
factor
=
4
)
s
[
CC
]
.
reorder
(
ko
,
xc
,
ki
,
yc
)
s
[
CC
]
.
unroll
(
ki
)
s
[
CC
]
.
vectorize
(
yc
)
# Vectorization
s
[
C
]
.
vectorize
(
yi
)
# Parallelization
s
[
C
]
.
parallel
(
yo
)
s
[
output
]
.
unroll
(
xi
)
s
[
output
]
.
vectorize
(
yi
)
scheduled_ops
.
append
(
op
)
fused
=
s
[
output
]
.
fuse
(
xo
,
yo
)
s
[
output
]
.
parallel
(
fused
)
s
[
CC
]
.
compute_at
(
s
[
output
],
fused
)
traverse
(
outs
[
0
]
.
op
)
traverse
_inline
(
s
,
outs
[
0
]
.
op
,
_callback
)
return
s
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