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
f863bfdc
Commit
f863bfdc
authored
Sep 22, 2017
by
Tianqi Chen
Committed by
GitHub
Sep 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TOPI] Fix reduce fusion with more levels (#477)
parent
262345fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
topi/python/topi/cuda/reduction.py
+5
-1
topi/tests/python/test_topi_reduce.py
+2
-2
No files found.
topi/python/topi/cuda/reduction.py
View file @
f863bfdc
...
...
@@ -60,8 +60,12 @@ def schedule_reduce(outs):
sch
=
tvm
.
create_schedule
([
x
.
op
for
x
in
outs
])
def
traverse_before_reduce
(
operator
):
if
tag
.
is_injective
(
operator
.
tag
):
if
isinstance
(
operator
,
tvm
.
tensor
.
PlaceholderOp
):
return
elif
tag
.
is_injective
(
operator
.
tag
):
sch
[
operator
]
.
compute_inline
()
for
tensor
in
operator
.
input_tensors
:
traverse_before_reduce
(
tensor
.
op
)
else
:
raise
RuntimeError
(
"Unsupported operator:
%
s"
%
operator
.
tag
)
...
...
topi/tests/python/test_topi_reduce.py
View file @
f863bfdc
...
...
@@ -7,7 +7,7 @@ import topi
def
verify_reduce_map_ele
(
in_shape
,
axis
,
keepdims
,
type
=
"sum"
):
# Build the logic and compile the function
A
=
tvm
.
placeholder
(
shape
=
in_shape
,
name
=
"A"
)
A1
=
topi
.
exp
(
A
)
A1
=
topi
.
sqrt
(
topi
.
exp
(
A
)
)
if
type
==
"sum"
:
B
=
topi
.
sum
(
A1
,
axis
=
axis
,
keepdims
=
keepdims
)
elif
type
==
"max"
:
...
...
@@ -26,7 +26,7 @@ def verify_reduce_map_ele(in_shape, axis, keepdims, type="sum"):
foo
=
tvm
.
build
(
s
,
[
A
,
B
],
device
,
name
=
"sum"
)
# Test
in_npy
=
np
.
random
.
uniform
(
size
=
in_shape
)
.
astype
(
np
.
float32
)
in_npy_map
=
np
.
exp
(
in_npy
)
in_npy_map
=
np
.
sqrt
(
np
.
exp
(
in_npy
)
)
if
type
==
"sum"
:
out_npy
=
in_npy_map
.
sum
(
axis
=
axis
,
keepdims
=
keepdims
)
elif
type
==
"max"
:
...
...
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