This is an automated email from the ASF dual-hosted git repository.

masahi 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 fe3fa9d75d [Fix][TIR] Fix tvm::arith::UnionLowerBound (#14304)
fe3fa9d75d is described below

commit fe3fa9d75d6bda75cca644516b3cbcdedd0354a8
Author: Biubiubiu12-intellif <[email protected]>
AuthorDate: Fri Mar 17 17:48:13 2023 +0800

    [Fix][TIR] Fix tvm::arith::UnionLowerBound (#14304)
    
    * [Fix][TIR] Fix tvm::arith::UnionLowerBound
    
    * fix CI test
    
    ---------
    
    Co-authored-by: root <[email protected]>
---
 src/arith/int_set.cc                       | 1 +
 tests/python/unittest/test_arith_intset.py | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/src/arith/int_set.cc b/src/arith/int_set.cc
index 7d601d9a8b..a75d316a7e 100644
--- a/src/arith/int_set.cc
+++ b/src/arith/int_set.cc
@@ -865,6 +865,7 @@ IntSet UnionLowerBound(const Array<IntSet>& sets) {
   PrimExpr min_inclusive{nullptr};
   PrimExpr max_inclusive(nullptr);
   for (const IntSet& int_set : sets) {
+    if (int_set.IsNothing()) continue;
     if (const auto* interval_set = int_set.as<IntervalSetNode>()) {
       PrimExpr new_min_inclusive = interval_set->min_value;
       PrimExpr new_max_inclusive = interval_set->max_value;
diff --git a/tests/python/unittest/test_arith_intset.py 
b/tests/python/unittest/test_arith_intset.py
index da3fd94f81..5b99115148 100644
--- a/tests/python/unittest/test_arith_intset.py
+++ b/tests/python/unittest/test_arith_intset.py
@@ -373,6 +373,10 @@ def test_union_lower_bound():
     result = tvm.arith.int_set.union_lower_bound([set_0, set_1])
     assert result.min_value.same_as(neg_inf)
     assert result.max_value.same_as(pos_inf)
+    set_2 = tvm.arith.IntervalSet(min_value=pos_inf, max_value=neg_inf)
+    result = tvm.arith.int_set.union_lower_bound([set_0, set_1, set_2])
+    assert result.min_value.same_as(neg_inf)
+    assert result.max_value.same_as(pos_inf)
 
 
 if __name__ == "__main__":

Reply via email to