pytorch
bee2d485 - [ONNX] Enable data propagation from ONNX to simplify current shape inference (#75307)

Commit
2 years ago
[ONNX] Enable data propagation from ONNX to simplify current shape inference (#75307) **Description** - Obtain the result (generatedShapeDataByName) from onnx::shape_inference::InferShapesAndDataPropagation. If PyTorch cannot consume latest ONNX shortly, we can still use ONNX node-level shape inference here to obtain those symbolic shape inference data. To keep this POC PR simple, use `onnx::shape_inference::InferShapesAndDataPropagation` here for now - Utilize Shape and Gather op first - Next step -- try to utilize it with more ops, in another PR. ONNX symbolic shape inference support is limited now. Here are the supported ops: - Shape - Reshape - Squeeze - Unsqueeze - Cast - Add - Sub - Mul - Gather - Slice - Concat Will focus on enabling these ops in the exporter first. In the future we can enable more ops in ONNX and then utilize them in the exporter. **Motivation** Fixes #75677. ONNX introduced symbolic shape inference as [data propagation](https://github.com/onnx/onnx/blob/master/docs/proposals/SymbolicShapeInfProposal.md) in version 1.10. This PR uses this functionality to simplify the shape inference code in torch.onnx. This PR depends on https://github.com/onnx/onnx/pull/3879. Pull Request resolved: https://github.com/pytorch/pytorch/pull/75307 Approved by: https://github.com/garymm, https://github.com/BowenBao
Author
Committer
Parents
Loading