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
f491a7c2
Commit
f491a7c2
authored
Oct 12, 2017
by
陳煒
Committed by
Tianqi Chen
Oct 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TEST] Use equal for equality comparison expression (#543)
also improve comment and unit test
parent
624c37df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
python/tvm/ir_builder.py
+1
-1
tests/python/unittest/test_ir_builder.py
+2
-1
No files found.
python/tvm/ir_builder.py
View file @
f491a7c2
...
...
@@ -90,7 +90,7 @@ class IRBuilder(object):
n = tvm.var("n")
A = ib.allocate("float32", n, name="A")
with ib.for_range(0, n, name="i") as i:
with ib.if_scope((i
% 2
)
== 0
):
with ib.if_scope((i
% 2
)
.equal(0)
):
A[i] = A[i] + 1
# The result stmt.
stmt = ib.get()
...
...
tests/python/unittest/test_ir_builder.py
View file @
f491a7c2
...
...
@@ -25,7 +25,7 @@ def test_if():
n
=
tvm
.
var
(
"n"
)
A
=
ib
.
pointer
(
"float32"
,
name
=
"A"
)
with
ib
.
for_range
(
0
,
n
,
name
=
"i"
)
as
i
:
with
ib
.
if_scope
((
i
%
2
)
==
0
):
with
ib
.
if_scope
((
i
%
2
)
.
equal
(
0
)
):
A
[
i
]
=
A
[
i
]
+
1
with
ib
.
else_scope
():
A
[
0
]
=
A
[
i
]
+
2
...
...
@@ -34,6 +34,7 @@ def test_if():
assert
isinstance
(
body
,
tvm
.
stmt
.
For
)
body
=
body
.
body
assert
isinstance
(
body
,
tvm
.
stmt
.
IfThenElse
)
assert
isinstance
(
body
.
condition
,
tvm
.
expr
.
EQ
)
assert
isinstance
(
body
.
then_case
.
index
,
tvm
.
expr
.
Var
)
assert
body
.
else_case
.
index
.
value
==
0
...
...
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