Remove metadata on delegate getitem nodes (#342)
Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/342 mcr229 filed an issue which is that the delegate's getitem nodes (the nodes pointing to each result of the call_delegate call) contain the metadata of the original nodes, specifically the source_fn metadata. This causes an issue because if we have 2 calls to to_backend, the first call will partition torch.nn.Linear using source_fn metadata, and create a call_delegate node along with getitem calls which now contain the torch.nn.Linear source_fn metadata. When a second to_backend call comes along, if it also wants to partition based on torch.nn.Linear source_fn metadata, it will incorrectly partition the getitem nodes to the delegates made by the first to_backend call. Implementation wise, this happens because the fuse_as_graphmodule function will automatically propagate metadata of the nodes being partitioned, to the getitem nodes. So, we will need to insert an extra pass to remove the metadata on these nodes. Note that this will also remove the "val" metadata, but we will bring it back in final the ExportPass() call at the end of to_backend. Reviewed By: digantdesai, cccclai Differential Revision: D49264387 fbshipit-source-id: 4755b2561f926738524c421d370525611fbfe4c9
A
Angela Yi committed
d3010473382278264f453077152fa186022dceaa
Parent: 65189b5
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 9/15/2023, 12:12:29 AM