Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Use equal for equality comparison expression #543

Merged
merged 2 commits into from
Oct 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/tvm/ir_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion tests/python/unittest/test_ir_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down