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
b20678b0
Commit
b20678b0
authored
Oct 12, 2017
by
ziheng
Committed by
Tianqi Chen
Oct 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TOPI] Fix declaration for different dtypes (#546)
parent
b384cd4a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
python/tvm/expr.py
+3
-1
topi/python/topi/nn/elemwise.py
+1
-1
topi/python/topi/nn/pooling.py
+1
-1
No files found.
python/tvm/expr.py
View file @
b20678b0
...
...
@@ -18,6 +18,7 @@ For example, you can use addexp.a to get the left operand of an Add node.
from
__future__
import
absolute_import
as
_abs
from
._ffi.node
import
NodeBase
,
register_node
from
.
import
make
as
_make
from
.
import
_api_internal
class
ExprOp
(
object
):
def
__add__
(
self
,
other
):
...
...
@@ -60,7 +61,8 @@ class ExprOp(object):
return
_make
.
Mod
(
self
,
other
)
def
__neg__
(
self
):
return
self
.
__mul__
(
-
1
)
neg_one
=
_api_internal
.
_const
(
-
1
,
self
.
dtype
)
return
self
.
__mul__
(
neg_one
)
def
__lshift__
(
self
,
other
):
return
_make
.
Call
(
self
.
dtype
,
"shift_left"
,
[
self
,
other
],
Call
.
PureIntrinsic
,
None
,
0
)
...
...
topi/python/topi/nn/elemwise.py
View file @
b20678b0
...
...
@@ -17,7 +17,7 @@ def relu(x):
y : tvm.Tensor
The result.
"""
return
tvm
.
compute
(
x
.
shape
,
lambda
*
i
:
tvm
.
max
(
x
(
*
i
),
0
))
return
tvm
.
compute
(
x
.
shape
,
lambda
*
i
:
tvm
.
max
(
x
(
*
i
),
tvm
.
const
(
0
,
x
.
dtype
)
))
@tvm.tag_scope
(
tag
=
tag
.
ELEMWISE
)
...
...
topi/python/topi/nn/pooling.py
View file @
b20678b0
...
...
@@ -38,7 +38,7 @@ def global_pool(data, pool_type):
tvm
.
sum
(
data
[
n
,
c
,
dheight
,
dwidth
],
axis
=
[
dheight
,
dwidth
]),
\
tag
=
"global_pool_sum"
)
return
tvm
.
compute
((
batch
,
channel
,
1
,
1
),
lambda
n
,
c
,
h
,
w
:
\
tsum
[
n
,
c
,
h
,
w
]
/
(
height
*
width
),
\
tsum
[
n
,
c
,
h
,
w
]
/
(
height
*
width
)
.
astype
(
tsum
.
dtype
)
,
\
tag
=
tag
.
ELEMWISE
)
else
:
raise
ValueError
(
"Pool type should be 'avg' or '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