[Relay] [Error] fuse does not work on trivial usecase of tuplegetitem


#1

So fuse_ops does not work, as https://github.com/dmlc/tvm/pull/3026 break it.
Just to save you from clicking, here is the offending test:

def test_tuple_getitem():
two = relay.add(relay.const(1), relay.const(1))
func = relay.Function([], relay.TupleGetItem(relay.Tuple([relay.const(1), relay.const(2)]), 0))
check_eval(func, [], 1)

What should we do to fix it?
@masahi @tqchen


#2

As I mentioned there, we need to come up a criteria to decide whether or not a new fused function should be primitive.

My understanding is, a function is “Primitive” if it needs to be lowered to and compiled by TVM (that is, the layer below Relay). In your test case, everything is constant, so the Relay interpreter can directly evaluate the whole function. There is no primitive function in this case.