You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by kp...@apache.org on 2023/09/05 17:29:18 UTC
[tvm] branch main updated: [IR] Use structural equal for Range equality (#15664)
This is an automated email from the ASF dual-hosted git repository.
kparzysz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 04ee895d8d [IR] Use structural equal for Range equality (#15664)
04ee895d8d is described below
commit 04ee895d8d102ea5aedd6480e7d5f4093c54d27d
Author: Anirudh Sundar Subramaniam <qu...@quicinc.com>
AuthorDate: Tue Sep 5 22:59:11 2023 +0530
[IR] Use structural equal for Range equality (#15664)
This PR adds a small change to verify equality of `tvm.ir.Range` as a
structural equal. This assumes that in most cases, comparing two
`Range`s means to compare its `min` and `extent` as opposed to the
actual Range object handle.
---
python/tvm/ir/expr.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/python/tvm/ir/expr.py b/python/tvm/ir/expr.py
index 5a83d8e5d9..f0f2245e7f 100644
--- a/python/tvm/ir/expr.py
+++ b/python/tvm/ir/expr.py
@@ -177,3 +177,9 @@ class Range(Node, Scriptable):
The constructed range.
"""
return _ffi_api.Range_from_min_extent(min_value, extent, span)
+
+ def __eq__(self, other):
+ return tvm.ir.structural_equal(self, other)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)