KEMBAR78
[ONNX] Improve dynamic_axes to dynamic_shapes conversion in exporter · Issue #150940 · pytorch/pytorch · GitHub
Skip to content

[ONNX] Improve dynamic_axes to dynamic_shapes conversion in exporter #150940

@titaiwangms

Description

@titaiwangms

To improve the backward compatibility of torch.onnx.export dynamo=True/False (torchscript-based and torch.export-based), dynamic_axes needs to be converted to dynamic_shapes.

ONNX has a naive approach to convert dynamic_axes to dynamic_shapes.

def from_dynamic_axes_to_dynamic_shapes(

To avoid the ordering issue (torch.export dynamic_shapes requires None to mark optional inputs), the implementation uses model.signature to tuplify inputs and dynamic_shapes, which results in lower coverage.

After #150583, there should be spaces to improve, where we should be able to unflatten dynamic_axes by following args/kwargs tree structure.

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