junrushao1994 commented on code in PR #12034:
URL: https://github.com/apache/tvm/pull/12034#discussion_r916278184


##########
python/tvm/tir/expr.py:
##########
@@ -562,9 +562,13 @@ def __nonzero__(self):
         return self.value != 0
 
     def __eq__(self, other):
+        if not isinstance(other, IntImm):
+            return False

Review Comment:
   this check overlooks the possibility where we want to compare with python's 
builtin `int`.
   
   if we really want to support the case where we compare `PrimExpr` to `None`, 
the most conservative check should be:
   
   ```suggestion
           if other is None:
               return getattr(self, "handle", None) is None
   ```
   
   however, i suppose that the TVM FFI should handle the case where IntImm is 
`IntImm(nullptr)`. Therefore, if it segfaults, it might be more fundamental and 
the fix I proposed shouldn't be the most proper. Would be great if we take a 
deeper dive



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to