Skip to content

Commit 573f140

Browse files
author
Umang Yadav
committed
Use fdiv in the tests for the deduce_bound
1 parent c4e4ec0 commit 573f140

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/python/unittest/test_arith_deduce_bound.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def test_deduce():
3535
d_s = tvm.arith.IntervalSet(-3, -1)
3636
zero = tvm.const(0, "int32")
3737

38-
tdiv = tvm.truncdiv
38+
fdiv = tvm.floordiv
3939

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

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

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

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

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

6464

@@ -81,7 +81,7 @@ def test_deduce():
8181

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

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

0 commit comments

Comments
 (0)