You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/07/05 04:20:10 UTC

[GitHub] [tvm] lazycal commented on pull request #12007: Fix infercorrect layout in Layoutrewrite and improve naming.

lazycal commented on PR #12007:
URL: https://github.com/apache/tvm/pull/12007#issuecomment-1174592052

   To reproduce the problem, run the following code:
   ```python
   import tvm
   from tvm import relay
   from tvm.relay.transform import InferType
   
   
   @tvm.instrument.pass_instrument
   class PrintIR:
       """Print the name of the pass, the IR, only before passes execute."""
   
       def __init__(self, print_mod=True, show_meta_data=False) -> None:
           self.pass_cnt = 0
           self.print_mod = print_mod
           self.show_meta_data = show_meta_data
   
       def run_before_pass(self, mod, info):
           with tvm.transform.PassContext(instruments=[]):
               global prev_mod
               if self.print_mod:
                   print(relay.transform.InferType()(mod))
               print('>' * 40, f'Running Pass#{self.pass_cnt}:', info)
   
           self.pass_cnt += 1
   
   
   x = relay.var("x", shape=(1, 1, 1, 1))
   y = relay.image.resize2d(x, (2, 4))
   z = relay.mean(y, axis=3)
   a = relay.image.resize1d(z, (1,))
   func = relay.Function((x,), a)
   mod = tvm.IRModule.from_expr(func)
   print(InferType()(mod))
   
   with tvm.transform.PassContext(opt_level=4, instruments=[PrintIR()]):
       relay.create_executor("graph", mod).evaluate()
   print('pass')
   ```


-- 
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: commits-unsubscribe@tvm.apache.org

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