to_onnx: another export to investigateΒΆ

to_onnx implements another exporter to ONNX. It does not support all the cases torch.onnx.export(). It fails rather trying different options to recover. It calls torch.export.export() but does not alter the graph (no rewriting, no decomposition) before converting this graph to onnx. It is used to investigate export issues raised by torch.export.export().

Simple Case

Dynamic Shapes

Dynamic shapes should be utilized to create a model capable of handling inputs with varying shapes while maintaining the same rank. Section torch.export.export: export to a Graph provides a couple of examples on how to define them, as their definition aligns with those used in torch.export.export().

Control Flow

Custom Operators

Submodules

Optimization