Skip to content

Commit 04ee895

Browse files
[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.
1 parent 476d9d1 commit 04ee895

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/tvm/ir/expr.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,9 @@ def from_min_extent(min_value, extent, span=None):
177177
The constructed range.
178178
"""
179179
return _ffi_api.Range_from_min_extent(min_value, extent, span)
180+
181+
def __eq__(self, other):
182+
return tvm.ir.structural_equal(self, other)
183+
184+
def __ne__(self, other):
185+
return not self.__eq__(other)

0 commit comments

Comments
 (0)