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/03/14 19:44:36 UTC

[GitHub] [tvm] gromero commented on pull request #10504: Complete pytorch grid_sample

gromero commented on pull request #10504:
URL: https://github.com/apache/tvm/pull/10504#issuecomment-1067217274


   @shukun-ziqiangxu Thanks for addressing our comments.
   
   The CI seems to be failing primarily due to `tests/python/relay/test_any.py`  failing after your change. I can at least reproduce the CI error locally running only the `test_any_grid_sample` the following way:
   
   ```bash
   $ pytest -k test_any_grid_sample tests/python/relay/test_any.py
   ```
   
   Apparently  `relay.image.grid_sample()` is not playing well anymore with `data_shape` with a `relay.Any()` class object. if s/`relay.Any()`/`4`, for instance, then the test passes. I can't tell exactly why that happens by reading your code.
   
   I'll paste below a simple reproduce, in case it helps:
   
   ```
   import tvm
   import tvm.relay as relay
   import numpy as np
   import tvm.testing
   
   data_shape=(relay.Any(), 4, 16, 32) # BROKEN, traceback as in the CI
   # data_shape=(4, 4, 16, 32) # WORKS!
   grid_shape=(4, 2, 8, 8)
   static_data_shape=(4, 4, 16, 32)
   ref_out_shape=(4, 4, 8, 8)
   
   mod = tvm.IRModule()
   dtype = "float32"
   data = relay.var("data", shape=data_shape, dtype=dtype)
   grid = relay.var("grid", shape=grid_shape, dtype=dtype)
   y = relay.image.grid_sample(data, grid)
   # or the following. Either one works:
   """
   y = relay.image.grid_sample(
              data,
              grid,
              method="bilinear",
              layout="NCHW",
              padding_mode="zeros",
              align_corners=False,
   )
   """
   
   mod["main"] = relay.Function([data, grid], y)
   data_np = np.random.uniform(size=static_data_shape).astype(dtype)
   grid_np = np.random.uniform(size=grid_shape).astype(dtype)
   
   tgts_devs = tvm.testing.enabled_targets()
   (tgt, dev) = tgts_devs[0]
   
   executor = relay.create_executor("vm", mod=mod, device=dev, target=tgt)
   executor.evaluate()(data_np, grid_np)
   ```
   
   Could you please fix it?
   
   Finally, `Co-authored-by:  shukun.net` actually can be removed, since from your email it's clear that you're contributing it from shukun.net (i.e. from `Ziqiang XU <xu...@shukun.net>`). I just suggested that tag because I thought there were other engineers from Shukun that worked on the code and that you would like to mention.
   
   Thanks.
   
   


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