Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
079e2307
Commit
079e2307
authored
7 years ago
by
masahi
Committed by
Tianqi Chen
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
simplify expr in get_const_tuple (#795)
* fix upsampling output shape * simplify expr in get_const_tuple
parent
ebf4e5a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
topi/python/topi/nn/upsampling.py
+3
-2
3 additions, 2 deletions
topi/python/topi/nn/upsampling.py
topi/python/topi/util.py
+2
-3
2 additions, 3 deletions
topi/python/topi/util.py
with
5 additions
and
5 deletions
topi/python/topi/nn/upsampling.py
+
3
−
2
View file @
079e2307
"""
TVM operator upsampling compute.
"""
from
__future__
import
absolute_import
import
tvm
from
..
import
util
def
upsampling
(
data
,
scale
):
...
...
@@ -21,8 +22,8 @@ def upsampling(data, scale):
4-D with shape [batch, channel, in_height*scale, in_width*scale]
"""
batch
,
channel
,
height
,
width
=
data
.
shape
out_height
=
height
*
scale
out_width
=
width
*
scale
out_height
=
util
.
simplify
(
height
*
scale
)
out_width
=
util
.
simplify
(
width
*
scale
)
return
tvm
.
compute
((
batch
,
channel
,
out_height
,
out_width
),
\
lambda
n
,
c
,
h
,
w
:
data
[
n
,
c
,
h
/
scale
,
w
/
scale
])
This diff is collapsed.
Click to expand it.
topi/python/topi/util.py
+
2
−
3
View file @
079e2307
...
...
@@ -59,9 +59,8 @@ def get_const_tuple(in_tuple):
"""
out_tuple
=
()
for
elem
in
in_tuple
:
if
not
isinstance
(
elem
,
(
tvm
.
expr
.
IntImm
,
tvm
.
expr
.
UIntImm
)):
raise
ValueError
(
"
Element of input tuple should be const int
"
)
out_tuple
=
out_tuple
+
(
elem
.
value
,
)
value
=
get_const_int
(
elem
)
out_tuple
=
out_tuple
+
(
value
,
)
return
out_tuple
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment