You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2020/10/10 11:45:31 UTC

[incubator-tvm] branch master updated: Revert "[Relay] Keep fixed dim when unifying dynamic shape (#5795)" (#6658)

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

masahi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a33774  Revert "[Relay] Keep fixed dim when unifying dynamic shape (#5795)" (#6658)
5a33774 is described below

commit 5a3377460b75336c937ff1cbc9fac3ff8b69af31
Author: masahi <ma...@gmail.com>
AuthorDate: Sat Oct 10 20:45:13 2020 +0900

    Revert "[Relay] Keep fixed dim when unifying dynamic shape (#5795)" (#6658)
    
    * Revert "[Relay] Keep fixed dim when unifying dynamic shape (#5795)"
    
    This reverts commit 782190e88b1941fdbe31101af260bee06b81bf72.
    
    * run infer type on test_sparse_dense_padded_alter_op() to fix CI
    
    Co-authored-by: masa <ma...@pop-os.localdomain>
---
 src/relay/analysis/type_solver.cc            | 11 -----------
 tests/python/relay/test_type_infer.py        | 11 -----------
 tests/python/topi/python/test_topi_sparse.py |  3 ++-
 3 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/relay/analysis/type_solver.cc b/src/relay/analysis/type_solver.cc
index 2b0e30b..8c1cc92 100644
--- a/src/relay/analysis/type_solver.cc
+++ b/src/relay/analysis/type_solver.cc
@@ -186,17 +186,6 @@ class TypeSolver::Unifier : public TypeFunctor<Type(const Type&, const Type&)> {
     if (ulhs.same_as(urhs)) {
       return ulhs;
     }
-
-    if (ulhs.as<AnyNode>() && urhs.as<tvm::IntImmNode>()) {
-      solver_->shape_uf_.Set(urhs, ulhs);
-      return urhs;
-    }
-
-    if (ulhs.as<tvm::IntImmNode>() && urhs.as<AnyNode>()) {
-      solver_->shape_uf_.Set(ulhs, urhs);
-      return ulhs;
-    }
-
     if (ulhs.as<AnyNode>() || urhs.as<AnyNode>()) {
       return Any();
     }
diff --git a/tests/python/relay/test_type_infer.py b/tests/python/relay/test_type_infer.py
index 6758d96..b518c31 100644
--- a/tests/python/relay/test_type_infer.py
+++ b/tests/python/relay/test_type_infer.py
@@ -22,7 +22,6 @@ import tvm
 
 from tvm import IRModule, te, relay, parser
 from tvm.relay import op, transform, analysis
-from tvm.relay import Any
 
 
 def infer_mod(mod, annotate_spans=True):
@@ -388,16 +387,6 @@ def test_let_polymorphism():
     tvm.ir.assert_structural_equal(body.checked_type, relay.TupleType([int32, relay.TupleType([])]))
 
 
-def test_if():
-    choice_t = relay.FuncType([], relay.scalar_type("bool"))
-    f = relay.Var("f", choice_t)
-    true_branch = relay.Var("True", relay.TensorType([Any(), 1], dtype="float32"))
-    false_branch = relay.Var("False", relay.TensorType([Any(), Any()], dtype="float32"))
-    top = relay.Function([f, true_branch, false_branch], relay.If(f(), true_branch, false_branch))
-    ft = infer_expr(top)
-    tvm.ir.assert_structural_equal(ft.ret_type, relay.TensorType([Any(), 1], dtype="float32"))
-
-
 def test_type_arg_infer():
     code = """
 #[version = "0.0.5"]
diff --git a/tests/python/topi/python/test_topi_sparse.py b/tests/python/topi/python/test_topi_sparse.py
index 07af478..9426eb7 100644
--- a/tests/python/topi/python/test_topi_sparse.py
+++ b/tests/python/topi/python/test_topi_sparse.py
@@ -466,7 +466,8 @@ def test_sparse_dense_padded_alter_op():
             ),
         )
         f = relay.Function([], mult)
-        f_ = relay.transform.AlterOpLayout()(tvm.IRModule.from_expr(f))
+        f = relay.transform.InferType()(tvm.IRModule.from_expr(f))
+        f_ = relay.transform.AlterOpLayout()(f)
         assert f_["main"].body.op.name == "nn.internal.sparse_dense_padded"