Skip to content

Commit

Permalink
[ARITH] Switch indexdiv/mod to floor
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Sep 27, 2019
1 parent c93b69f commit 7ad30db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions python/tvm/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ def __rtruediv__(self, other):
return _generic.divide(other, self)

def __floordiv__(self, other):
# return _generic.floordiv(self, other)
return _generic.divide(self, other)
return _generic.floordiv(self, other)
# return _generic.divide(self, other)

def __rfloordiv__(self, other):
# return _generic.floordiv(other, self)
return _generic.divide(other, self)
return _generic.floordiv(other, self)
# return _generic.divide(other, self)

def __mod__(self, other):
# raise div_ambiguity_error()
return _make._OpMod(self, other)
return _make._OpFloorMod(self, other)

def __neg__(self):
neg_one = _api_internal._const(-1, self.dtype)
Expand Down
4 changes: 2 additions & 2 deletions src/lang/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
namespace tvm {

// TODO(tqchen): change to floormod/div
using IndexMod = ir::Mod;
using IndexDiv = ir::Div;
using IndexMod = ir::FloorMod;
using IndexDiv = ir::FloorDiv;

Array<Expr> SimplifyArray(Array<Expr> array) {
for (size_t i = 0; i < array.size(); ++i) {
Expand Down
4 changes: 2 additions & 2 deletions src/lang/expr_operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ Expr operator%(Expr a, Expr b) {

// TODO(tqchen): switch to floordiv
Expr indexdiv(Expr a, Expr b) {
return truncdiv(a, b);
return floordiv(a, b);
}

Expr indexmod(Expr a, Expr b) {
return truncmod(a, b);
return floormod(a, b);
}

Expr floordiv(Expr a, Expr b) {
Expand Down

0 comments on commit 7ad30db

Please sign in to comment.