mbrookhart commented on issue #5928:
URL: https://github.com/apache/incubator-tvm/issues/5928#issuecomment-649870756


   Those two PRs plus this change to the script fixes the issue for me:
   
   ```
   import tvm 
   from tvm import relay
   from tvm.relay.dataflow_pattern import *
   import gluoncv as gcv # require pip install gluoncv
   from tvm.relay.build_module import bind_params_by_name
   
   def get_gcv_model(model_name):
       """Pull a Gluon CV model."""
       import gluoncv as gcv 
   
       model_name = model_name.lower()
   
       print('Pulling the model from Gluon CV model zoo...')
       shape = (1, 3, 224, 224)
       if model_name.find('inception') != -1: 
           shape = (1, 3, 299, 299)
       elif model_name.find('yolo3') != -1: 
           shape = (1, 3, 320, 320)
       elif model_name.startswith('ssd'):
           tokens = re.search(r'ssd_(\d+)_', model_name)
           size = int(tokens.group(1))
           shape = (1, 3, size, size)
       net = gcv.model_zoo.get_model(model_name, pretrained=True)
       ret = relay.frontend.from_mxnet(net, shape={'data': shape})
       return ret[0], ret[1], ('data', shape)
   
   mod, params, data_shape = get_gcv_model('mobilenetv2_1.0')
   mod["main"] = bind_params_by_name(mod["main"], params)
   mod = relay.transform.EliminateCommonSubexpr()(mod)
   
   bn_out = is_op('nn.batch_norm')(wildcard(), wildcard(), wildcard(), 
wildcard(), wildcard())
   pat = is_tuple_get_item(bn_out, 0)
   print(pat.partition(mod['main']))
   ~                                                        
   ```


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to