Skip to content

Commit

Permalink
Use fdiv in the tests for the deduce_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
Umang Yadav committed Sep 27, 2019
1 parent c4e4ec0 commit 573f140
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/python/unittest/test_arith_deduce_bound.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def test_deduce():
d_s = tvm.arith.IntervalSet(-3, -1)
zero = tvm.const(0, "int32")

tdiv = tvm.truncdiv
fdiv = tvm.floordiv

e0 = (-b)*a+c-d
res0 = tvm.arith.DeduceBound(a, e0>=0, {b: b_s, c: c_s, d: d_s}, {})
ans0 = (tdiv(d - c, b*-1) + (-1))
ans0 = fdiv(d - c, b*-1)
assert_expr_equal(res0.max_value, ans0)

# expression containing variable a is on rhs
Expand All @@ -48,7 +48,7 @@ def test_deduce():

e0 = d*a+c-d
res0 = tvm.arith.DeduceBound(a, e0>=0, {b: b_s, c: c_s, d: d_s}, {})
ans0 = (tdiv(d-c,d) - 1)
ans0 = fdiv(d-c, d)
assert_expr_equal(res0.max_value, ans0)

# expression containing variable a is on rhs
Expand All @@ -58,7 +58,7 @@ def test_deduce():

e1 = (a*4+b < c)
res1 = tvm.arith.DeduceBound(a, e1, {b: b_s, c: c_s, d: d_s}, {})
ans1 = (tdiv((c - b) + -1,4) -1)
ans1 = fdiv(c-1-b, 4)
assert_expr_equal(res1.max_value, ans1)


Expand All @@ -81,7 +81,7 @@ def test_deduce():

e3 = (-b)+a*c-d
res3 = tvm.arith.DeduceBound(a, e3>=0, {b: b_s, c: c_s, d: d_s}, {b: b_s, d: d_s})
ans3 = tdiv(2,c)+1
ans3 = fdiv(2,c)+1
assert str(tvm.ir_pass.Simplify(res3.min_value)) == str(ans3)

res3 = tvm.arith.DeduceBound(a, zero <= e3, {b: b_s, c: c_s, d: d_s}, {b: b_s, d: d_s})
Expand Down

0 comments on commit 573f140

Please sign in to comment.