The following is an example:
dtype="float32"
x_shape = (1, 1, 3, 3)
w_shape = (1, 1, 1, 1)
x_np = np.random.random_sample(x_shape).astype(dtype)
np.savetxt("x_np.npy", x_np.flatten())
x_np = np.loadtxt("x_np.npy").reshape(x_shape).astype(dtype)
x = relay.var("x", shape=x_shape, dtype=dtype)
w_data = relay.const(make_arr(w_shape[1:], dtype))
w_indptrs = relay.const([0,1], "int32")
w_indices = relay.const([0], "int32")
z = relay.op.nn._make.sparse_conv2d(x, w_data, w_indices, w_indptrs, "NCHW")
func = relay.Function([x], z)
mod = tvm.IRModule().from_expr(func)
params = {}
inputs = {"x":tvm.nd.array(x_np)}
with tvm.transform.PassContext(opt_level=2):
exe = relay.backend.vm.compile(mod=mod, params=params, target="llvm")
vm = tvm.runtime.vm.VirtualMachine(exe, device=tvm.device("llvm"))
out = vm.run(**{**params, **inputs})
The result of each run with the same input is different.