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
76c23926
Commit
76c23926
authored
Oct 07, 2019
by
Logan Weber
Committed by
Tianqi Chen
Oct 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix match case in Python-side expr functor (#4037)
parent
a6cd6485
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
python/tvm/relay/expr_functor.py
+4
-1
tests/python/relay/test_expr_functor.py
+11
-0
No files found.
python/tvm/relay/expr_functor.py
View file @
76c23926
...
...
@@ -249,7 +249,10 @@ class ExprMutator(ExprFunctor):
return
con
def
visit_match
(
self
,
m
):
return
Match
(
self
.
visit
(
m
.
data
),
[
Clause
(
c
.
lhs
,
self
.
visit
(
c
.
rhs
))
for
c
in
m
.
clauses
])
return
Match
(
self
.
visit
(
m
.
data
),
[
Clause
(
c
.
lhs
,
self
.
visit
(
c
.
rhs
))
for
c
in
m
.
clauses
],
complete
=
m
.
complete
)
def
visit_ref_create
(
self
,
r
):
return
RefCreate
(
self
.
visit
(
r
.
value
))
...
...
tests/python/relay/test_expr_functor.py
View file @
76c23926
...
...
@@ -125,6 +125,16 @@ def test_match():
p
=
relay
.
prelude
.
Prelude
()
check_visit
(
p
.
mod
[
p
.
map
])
def
test_match_completeness
():
p
=
relay
.
prelude
.
Prelude
()
for
completeness
in
[
True
,
False
]:
match_expr
=
relay
.
adt
.
Match
(
p
.
nil
,
[],
complete
=
completeness
)
result_expr
=
ExprMutator
()
.
visit
(
match_expr
)
# ensure the mutator doesn't mangle the completeness flag
assert
result_expr
.
complete
==
completeness
if
__name__
==
"__main__"
:
test_constant
()
test_tuple
()
...
...
@@ -139,3 +149,4 @@ if __name__ == "__main__":
test_ref_write
()
test_memo
()
test_match
()
test_match_completeness
()
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