[SOLVED][Relay] Global reduce fails to compile


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)

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



This looks like a bug, could you open an issue on the Github issue tracker? I’ll try to chase it down.


  • Jared


Thanks. An issue has been filed.


This should now be fixed in master.