SIGN IN SIGN UP

Fix memory.view insertion except for output nodes (#3602)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/3602

The previous implementation of ignoring `view_copy` on outputs was incorrect
in that it only checked `node.next` instead of all users of the node.
`node.next` just selects the next node in topological order, which may or
may not be the output if there is more than one output. In the case of more
than one output, the next node may not be related at all!

Check if any of the users of the node are an output instead.

Reviewed By: metascroy, mcremon-meta

Differential Revision: D57299853

fbshipit-source-id: 6a373181f6bdd58444e0c859fce320d576b7f749
R
Riley Dulin committed
b64182d6413429851a4e1b444e3721f6d3764ee0
Parent: 01ce72c
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 5/14/2024, 6:45:56 PM