Skip to content

Commit 526ff04

Browse files
Ziheng Jiangtqchen
authored andcommitted
[PYTHON/API] Add compare and logic build-in op for Expr (#39)
* [PYTHON/API] Add compare and logic build-in op for Expr * remove 'and', 'or'
1 parent 45597d0 commit 526ff04

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

python/tvm/expr.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,24 @@ def __rtruediv__(self, other):
3737
def __neg__(self):
3838
return self.__mul__(-1)
3939

40+
def __lt__(self, other):
41+
return _make.LT(self, other)
42+
43+
def __le__(self, other):
44+
return _make.LE(self, other)
45+
46+
def __eq__(self, other):
47+
return _make.EQ(self, other)
48+
49+
def __ne__(self, other):
50+
return _make.NE(self, other)
51+
52+
def __gt__(self, other):
53+
return _make.GT(self, other)
54+
55+
def __ge__(self, other):
56+
return _make.GE(self, other)
57+
4058

4159
class Expr(NodeBase, ExprOp):
4260
pass

0 commit comments

Comments
 (0)