tvm
tvm copied to clipboard
[Relax][Transform] Handle tuple return in RemoveUnusedOutputs
Prior to this commit, the relax.transform.RemoveUnusedOutputs pass only marked a tuple element as used if it occurred in a TupleGetItem node. This ignored use cases where a tuple is used as an aggregate object, such as returning a tuple from a function. This would collect incorrect results for a Relax function that calls a subroutine, receives a tuple as the return value of the subroutine, then returns that tuple.
This commit updates RemoveUnusedOutputs to look for usage of a tuple object, not just for usage in TupleGetItem.
Closes https://github.com/apache/tvm/issues/17247