Skip to content

Commit 5cdc860

Browse files
ZihengJiangtqchen
authored andcommitted
[TAG] Fix signature of decorated function (#228)
* [TAG] Fix signature of decorated function * Add dep
1 parent 72fcd4e commit 5cdc860

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

python/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def config_cython():
6767
description='A domain specific language(DSL) for tensor computations.',
6868
install_requires=[
6969
'numpy',
70+
'decorator',
7071
],
7172
zip_safe=False,
7273
packages=[

python/tvm/tag.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Tag class for TVM operators."""
2-
from functools import wraps
2+
from decorator import decorate
33

44
class TagScope(object):
55
"""Tag scope object to set tag for operators, working as context
@@ -22,11 +22,10 @@ def __exit__(self, ptype, value, trace):
2222
TagScope.current = self._old_scope
2323

2424
def __call__(self, fdecl):
25-
@wraps(fdecl)
26-
def tagged_fdecl(*args, **kwargs):
25+
def tagged_fdecl(func, *args, **kwargs):
2726
with self:
28-
return fdecl(*args, **kwargs)
29-
return tagged_fdecl
27+
return func(*args, **kwargs)
28+
return decorate(fdecl, tagged_fdecl)
3029

3130

3231
def tag_scope(tag):

tests/ci_build/install/ubuntu_install_python.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apt-get update && apt-get install -y python-pip python-dev python3-dev
44
# the version of the pip shipped with ubuntu may be too lower, install a recent version here
55
cd /tmp && wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && python2 get-pip.py
66

7-
pip2 install nose pylint numpy nose-timer cython
8-
pip3 install nose pylint numpy nose-timer cython
7+
pip2 install nose pylint numpy nose-timer cython decorator
8+
pip3 install nose pylint numpy nose-timer cython decorator

0 commit comments

Comments
 (0)