[ONNX] Update saved exported program in debugging report if the exporting passes run_decomposition() #148617
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previous to this PR, if the exporting passes run_decomposition(), the report still shows the exported_program before decomposition, which adds the difficulties to our users when they want to check the exported program that are used to translate to ONNX graph.
The following example is what we see before this PR:
✅ Obtain model graph with
torch.export.export(..., strict=False)⚪ Obtain model graph with
torch.export.export(..., strict=True)⚪ Obtain model graph with
torch.jit.trace✅ Decompose operators for ONNX compatibility
❌ Translate the graph into ONNX
⚪ Run
onnx.checkeron the ONNX model⚪ Execute the model with ONNX Runtime
⚪ Validate model output accuracy
Exported program
Analysis
PyTorch ONNX Conversion Analysis
Model Information
The model has 0 parameters and 0 buffers (non-trainable parameters).
Number of parameters per dtype:
Number of buffers per dtype:
Inputs:
x:TensorMetadata(shape=torch.Size([3, 4]), dtype=torch.float32, requires_grad=False, stride=(4, 1), memory_format=torch.contiguous_format, is_quantized=False, qparams={})Outputs:
slice_2:TensorMetadata(shape=torch.Size([3, 2]), dtype=torch.complex64, requires_grad=False, stride=(4, 1), memory_format=None, is_quantized=False, qparams={})The FX graph has 5 nodes in total. Number of FX nodes per op:
placeholder: 1call_function: 3output: 1Of the call_function nodes, the counts of operators used are:
aten.slice.Tensor: 2aten.to.dtype: 1ONNX Conversion Information
The model contains operators the dispatcher could not find registered ONNX decompositions for. This may be due to missing implementations, decompositions not registered correctly, or a bug in the dispatcher.
Errors grouped by operator:
aten.to.dtype: No decompositions registered for the real-valued input. Example node:%to : [num_users=1] = call_function[target=torch.ops.aten.to.dtype](args = (%x, torch.complex64), kwargs = {}). All nodes:[to]aten.slice.Tensor: No decompositions registered for the complex-valued input. Example node:%slice_1 : [num_users=1] = call_function[target=torch.ops.aten.slice.Tensor](args = (%to, 0, 0, 9223372036854775807), kwargs = {}). All nodes:[slice_1, slice_2]Decomposition comparison
Ops exist only in the ExportedProgram before decomposition:
['aten.to.dtype']Ops exist only in the ExportedProgram after decomposition:
['aten._to_copy.default']