saurabh-shandilya opened a new issue, #13543:
URL: https://github.com/apache/tvm/issues/13543

   I am running a pattern-matching test as described in the code below but it 
keeps failing with an error message. I tried to run match and replace the same 
pattern with partition and it works fine. I am curious about the reason for 
failure for mergeComposite when partition can work fine. 
   
   ```
   def test_pattern() -> tvm.relay.dataflow_pattern.DFPattern:
       score = wildcard()
       greater_p = is_op("greater")(score, is_constant())
       where_p = is_op("argwhere")(greater_p)
       sqz_p = is_op("squeeze")(where_p)
       return sqz_p
   
   from tvm.relay.op.contrib.register import  register_pattern_table
   @register_pattern_table("test_table1")
   def pattern_table():
       return [
           ("test_pattern", test_pattern()),
       ]
   def run_mergecomposite_pass(mod, params=None, **opts):
       seq = tvm.ir.transform.Sequential(
           [
               tvm.relay.transform.MergeComposite(pattern_table()),
           ]
       )
       return seq(mod)
   
   def test_partition_merge_composite():
       score = relay.var("score", shape=[7], dtype="float32")
       box = relay.var("box", shape=[7, 4], dtype="float32")
       g = relay.greater(score, relay.const(0.01))
       w = relay.argwhere(g)
       s = relay.squeeze(w, axis=[1])
       tb = (box, s)
       boxout = relay.adv_index(tb)
       scoreout = relay.adv_index((score, s))
       sourceexpand = relay.expand_dims(scoreout, axis=-1)
       finalout = relay.concatenate([boxout, sourceexpand], axis=-1)
   
       ## Following works fine
       mod_p = test_pattern().partition(finalout,{'Composite': 'test_pattern'})
       print(mod_p)
   
       ## But this does not
       mod1 = tvm.IRModule.from_expr(finalout)
       print(mod1)
       mod = run_mergecomposite_pass(mod1)
       print("after mergecomposite...")
       print(mod)
   
   ```
   
   ### Expected behavior
   
   I was expecting mergeComposite to work fine and since parition for the same 
pattern works fine. 
   
   ### Actual behavior
   
   I observed following error -
    _Check failed: (ref->template IsInstance<typename SubRef::ContainerType>()) 
is false: Downcast from IncompleteType to relay.TensorType failed._
   
   
   ### Environment
   
   tvm 0.9.dev0
   Windows
   torch 1.10.2
   torchvision 0.11.3
   
   ### Steps to reproduce
   
   Script is shared above.
   
   ### Triage
   
   
   * needs-triage
   


-- 
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