I was trying to use relay.sum
to perform global reduction on a tensor, but it fails to compile. I also noticed that this use case is skipped in the unit test. Is this a bug or a known issue of Relay?
def test_relay_sum():
ctx = tvm.cpu()
target = tvm.target.create('llvm')
shape = (3, 4)
x = relay.var('x', shape=shape)
y = relay.sum(x)
func = relay.Function([x], y)
x_data = np.random.rand(*shape).astype('float32')
intrp = relay.create_executor("debug", ctx=ctx, target=target)
ret = intrp.evaluate(func)(x_data)
print(ret)
Error message
tvm._ffi.base.TVMError: [15:03:02] src/runtime/module_util.cc:53: Check failed: ret == 0 (-1 vs. 0) Assert fail: (2 == tvm_struct_get(arg1, 0, 4)), arg1.ndim is expected to equal 2