Skip to content

[Relay] Global reduce fails to compile #2411

@reminisce

Description

@reminisce

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions