Skip to content

Commit

Permalink
[export] Conditionally load decomp table (pytorch#8209)
Browse files Browse the repository at this point in the history
Co-authored-by: Siyuan Liu <[email protected]>
  • Loading branch information
lsy323 and Siyuan Liu authored Oct 3, 2024
1 parent 4813702 commit c22dfe9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion torch_xla/stablehlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,10 @@ def _extract_input_args(exported_model, options):


def _run_decompositions(exported_model):
decomp_table = core_aten_decompositions()
if hasattr(torch.export, 'core_op_decompositions'):
decomp_table = torch.export.core_op_decompositions()
else:
decomp_table = core_aten_decompositions()
decomp_table.update(_extra_decompositions)
decomp_table[torch.ops.aten._safe_softmax.default] = torch.softmax
exported_model = exported_model.run_decompositions(decomp_table)
Expand Down

0 comments on commit c22dfe9

Please sign in to comment.