From 526ff04c7ece709611956f573ea97bb404ec6b06 Mon Sep 17 00:00:00 2001
From: Ziheng Jiang <jzhtomas@gmail.com>
Date: Fri, 10 Feb 2017 09:14:11 -0800
Subject: [PATCH] [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'
---
 python/tvm/expr.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/python/tvm/expr.py b/python/tvm/expr.py
index c3b0845ae..8ae1d45d8 100644
--- a/python/tvm/expr.py
+++ b/python/tvm/expr.py
@@ -37,6 +37,24 @@ class ExprOp(object):
     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)
+
 
 class Expr(NodeBase, ExprOp):
     pass
-- 
GitLab