ScatterND run failed on cpu

Hi community, I have a test about scatter_nd operator, here is the code:

import sys
import numpy as np
import tvm
from tvm import relay
from tvm.relay import create_executor, transform

if __name__=='__main__':
  data = relay.var("data", shape=(1, 1, 3, 1024, 512), dtype="float32")
  indices = relay.var("indices", shape=(5, 1, 1, 3, 1024, 512), dtype="int64")
  updates = relay.var("updates", shape=(1, 1, 3, 1024, 512), dtype="float32")

  out = relay.op.scatter_nd(data, indices, updates, "update")
  func = relay.Function([data, indices, updates], out)

  data_np = np.zeros((1, 1, 3, 1024, 512)).astype("float32")
  origin_indices = np.load("/home/hermanhe/indices")
  updates_np = np.ones((1, 1, 3, 1024, 512)).astype("float32")

  indices_np = np.transpose(origin_indices, (5, 0, 1, 2, 3, 4))

  op_res = relay.create_executor("graph", device=tvm.cpu(0), target="llvm").evaluate(func)(
    data_np, indices_np, updates_np
  )

the result like this:

Segmentation fault (core dumped)

but if I set the target with GPU, it will be fine, I find the compute of scatter_nd have some code undefined shape

 indices[i + l * fused_indices_dimension] < shape[l]

the indices file is here Can anyone give an advice about this, thanks!

After updating the latest version, the problem is gone, it has been fixed

1 Like