JR4er opened a new pull request, #14773:
URL: https://github.com/apache/tvm/pull/14773
```python
import tvm
import numpy as np
from tvm import relay
def should_pass():
data = relay.const(np.zeros([1,1,10], 'float32'))
indices = relay.const(np.ones([2,1,1,1], 'int64'))
updates = relay.const(np.random.rand(1,1,1,10).astype('float32'))
scatter_nd = relay.scatter_nd(data, indices, updates)
mod = tvm.IRModule.from_expr(scatter_nd)
mod = relay.transform.InferType()(mod)
def should_fail():
data = relay.const(np.zeros([1,1,10], 'float32'))
indices = relay.const(np.ones([2,1,1], 'int64'))
updates = relay.const(np.random.rand(1,1,5).astype('float32'))
scatter_nd = relay.scatter_nd(data, indices, updates)
mod = tvm.IRModule.from_expr(scatter_nd)
mod = relay.transform.InferType()(mod)
```
case `should_pass` will report a error
> Check failed: (0 <= i && i < p->size_) is false: IndexError: indexing 3 on
an array of size 3
case `should_fail` will pass incorrectly. however FoldConstant will find the
error:
> AssertionError: Dimension of updates[2] (5) must equal dimension of
out_shape[2] (10).
--
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]