[SR] Make fused_gather_ranges_to_dense work on graph outputs (#71498)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71498
We previously disabled `FuseListUnpack` if the fused outputs of the op would alias the graph outputs. The concern was that some ops were assuming that `p_node->Output(0).isTensor()` implies `p_node->Output(i).isTensor()` for all `i > 0`. This condition can be violated if there exists both managed and unmanaged tensors in the output list.
Instead of adding this special case and missing out on some fusions, we should implement fused ops correctly.
Test Plan: `buck test caffe2/benchmarks/static_runtime/...`
Reviewed By: navahgar
Differential Revision: D33663969
fbshipit-source-id: 904092630f66dbe65eab20c2d9453b9db4fcc6fd
(cherry picked from commit 7d35ab303f272996a788a86e3587bbc5a9365fec)