[ONNX] Add preprocess pass for onnx export#41832
[ONNX] Add preprocess pass for onnx export#41832BowenBao wants to merge 5 commits intopytorch:masterfrom
Conversation
💊 CI failures summary and remediationsAs of commit c0a532f (more details on the Dr. CI page): ✅ None of the CI failures appear to be your fault 💚
🚧 1 fixed upstream failure:These were probably caused by upstream breakages that were already fixed.
Please rebase on the
|
facebook-github-bot
left a comment
There was a problem hiding this comment.
@bzinodev has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
There was a problem hiding this comment.
@bzinodev has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: in `_jit_pass_onnx`, symbolic functions are called for each node for conversion. However, there are nodes that cannot be converted without additional context. For example, the number of outputs from split (and whether it is static or dynamic) is unknown until the point where it is unpacked by listUnpack node. This pass does a preprocess, and prepares the nodes such that enough context can be received by the symbolic function. * After preprocessing, `_jit_pass_onnx` should have enough context to produce valid ONNX nodes, instead of half baked nodes that replies on fixes from later postpasses. * `_jit_pass_onnx_peephole` should be a pass that does ONNX specific optimizations instead of ONNX specific fixes. * Producing more valid ONNX nodes in `_jit_pass_onnx` enables better utilization of the ONNX shape inference pytorch#40628. Pull Request resolved: pytorch#41832 Reviewed By: ZolotukhinM Differential Revision: D22968334 Pulled By: bzinodev fbshipit-source-id: 8226f03c5b29968e8197d242ca8e620c6e1d42a5
in
_jit_pass_onnx, symbolic functions are called for each node for conversion. However, there are nodes that cannot be converted without additional context. For example, the number of outputs from split (and whether it is static or dynamic) is unknown until the point where it is unpacked by listUnpack node. This pass does a preprocess, and prepares the nodes such that enough context can be received by the symbolic function._jit_pass_onnxshould have enough context to produce valid ONNX nodes, instead of half baked nodes that replies on fixes from later postpasses._jit_pass_onnx_peepholeshould be a pass that does ONNX specific optimizations instead of ONNX specific fixes._jit_pass_onnxenables better utilization of the ONNX shape inference [ONNX] Utilize ONNX shape inference for ONNX exporter #40628.