Skip to content

[ONNX] Convert dynamic_shapes to dynamic_axes when fallback is triggered in torch.onnx.export #139320

@titaiwangms

Description

@titaiwangms

torch.onnx.export fallback to torchscript graph when dynamo exporting fails:

fallback: bool = False,

However, users typically does not provide both dynamic_shapes (for torch.onnx.export(..., dynamo=True)) and dynamic_axes (torch.onnx.export(..., dynamo=False)) at the same time. A conversion from dynamic_shapes to dynamic axes is needed to improve fallback user experience.

dynamic_shapes: dict[str, Any] | tuple[Any, ...] | list[Any] | None = None,

dynamic_axes: Mapping[str, Mapping[int, str]]
| Mapping[str, Sequence[int]]
| None = None,

cc @xadupre

Metadata

Metadata

Assignees

Labels

module: onnxRelated to torch.onnxonnx-triagedtriaged by ONNX teamtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions