Skip to content

Commit 395733d

Browse files
committed
Update on "[ExecuTorch][Weight Sharing][XNNPACK] Serialize constant tensors into named data map"
We serialize tensors into the named data map, and return the output in preprocess result. Allowing for XNNPACK to share tensors with the same name (instead of duplicating). A key change here is with fused tensors. For BN and Convolution Fusion, we fuse the conv weights and bias with the BN parameters creating new tensors. We then create get_attr nodes for these new parameters. Due to the graph.fx interpreter in export pass base, the new names we create for these new tensors are lost each time. As a result, at the end we introduce a new pass to preserve the names we created. This seems a little hacky for now, but is the only way to preserve the new fused names. Differential Revision: [D70315207](https://our.internmc.facebook.com/intern/diff/D70315207/) **NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D70315207/)! [ghstack-poisoned]
2 parents 3313b2f + 70db3a5 commit 395733d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exir/backend/test/test_backend_with_named_data_map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def false_branch(self, x):
6767

6868
def forward(self, x, y):
6969
z = x / y
70-
z = torch.cond(z > 1, self.true_branch, self.false_branch, [x])
70+
z = torch.cond(z.sum() > 0, self.true_branch, self.false_branch, [x])
7171
return z - z
7272

7373
ep = to_edge(torch.export.export(M(), (torch.randn(1, 2), torch.randn(1, 2))))

0 commit comments

Comments
 (0)