Cnly opened a new issue #9955:
URL: https://github.com/apache/tvm/issues/9955


   ### Expected behavior
   
   `topi.scatter` is implemented with `@hybrid.script` and its body has 
something that looks like
   
   ```py
   for i in range(data.shape[0]):
   ```
   
   which should not be a problem when a module using scatter is built.
   
   ### Actual behavior
   
   However, when `topi.scatter` gets interpreted by `te/hybrid/parser.py`, 
there'll be an error `'IntImm' object is not iterable` from this line
   
   
https://github.com/apache/tvm/blob/211291fb9a59b5ca6aee6e83b7cd700f98463032/python/tvm/te/hybrid/parser.py#L379
   
   If I apply this patch, it seems to resolve the problem:
   
   ```diff
   ```
   
   ### Environment
   
   OS: Ubuntu 18.04.6 LTS
   TVM: Commit 211291fb9
   
   ### Steps to reproduce
   
   ```py
   import numpy as np
   import tvm
   import tvm.relay as relay
   
   idxes = np.array([[0, 1],
                     [2, 3],
                     [4, 5]])
   
   x = relay.zeros((3, 10), 'int32')
   y = relay.var("y", shape=idxes.shape, dtype='int32')
   z = relay.scatter(x, y, relay.full_like(y, relay.const(1)), -1)
   
   f = relay.Function([y], z)
   m = tvm.IRModule.from_expr(f)
   
   lib = relay.build(m, target='llvm')
   
   intrp = relay.create_executor('graph', mod=m)
   print(intrp.evaluate()(idxes))
   ```
   


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