Add a pass to convert rank-0 tensor to rank-1 tensor (#8298)
Add a pass to convert rank-0 tensor to rank-1 tensor (#8298)
Summary:
Test with following code, and no long see the error/warning to complain rank-0 tensor
```
class Model(torch.nn.Module):
def forward(self, x, y):
return x + y
model = Model()
model.eval()
example_inputs = (torch.tensor(1.0), torch.tensor(2.0))
exported_program_manager_aten = torch.export.export(model, example_inputs)
exported_program_manager_edge = executorch.exir.to_edge(
exported_program_manager_aten
).transform([Rank0ToRank1Pass()])
delegated_module = to_backend(
CoreMLBackend.__name__, exported_program_manager_edge.exported_program(), []
)
```
Differential Revision: D69281867 C
cccclai committed
994d94d600cce6645638f9a976de55d50b0bf286
Parent: 85231f5
Committed by GitHub <noreply@github.com>
on 2/11/2025, 11:37:55 PM