From 2b9cb33f3d3d26f83d2ea98cfaa0345c7a37c44d Mon Sep 17 00:00:00 2001 From: ZihengJiang Date: Fri, 10 Feb 2017 06:32:32 +0000 Subject: [PATCH 1/2] [PYTHON/API] Add compare and logic build-in op for Expr --- python/tvm/expr.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python/tvm/expr.py b/python/tvm/expr.py index c3b0845aecb6..3c6c9f023906 100644 --- a/python/tvm/expr.py +++ b/python/tvm/expr.py @@ -37,6 +37,30 @@ def __rtruediv__(self, other): def __neg__(self): return self.__mul__(-1) + def __lt__(self, other): + return _make.LT(self, other) + + def __le__(self, other): + return _make.LE(self, other) + + def __eq__(self, other): + return _make.EQ(self, other) + + def __ne__(self, other): + return _make.NE(self, other) + + def __gt__(self, other): + return _make.GT(self, other) + + def __ge__(self, other): + return _make.GE(self, other) + + def __and__(self, other): + return _make.And(self, other) + + def __or__(self, other): + return _make.And(self, other) + class Expr(NodeBase, ExprOp): pass From 461d7788aa2a820bc3a47318139d383c406cc34a Mon Sep 17 00:00:00 2001 From: ZihengJiang Date: Fri, 10 Feb 2017 16:45:21 +0000 Subject: [PATCH 2/2] remove 'and', 'or' --- python/tvm/expr.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/python/tvm/expr.py b/python/tvm/expr.py index 3c6c9f023906..8ae1d45d8b5e 100644 --- a/python/tvm/expr.py +++ b/python/tvm/expr.py @@ -55,12 +55,6 @@ def __gt__(self, other): def __ge__(self, other): return _make.GE(self, other) - def __and__(self, other): - return _make.And(self, other) - - def __or__(self, other): - return _make.And(self, other) - class Expr(NodeBase, ExprOp): pass