-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
The pass "fuse_concat_into_reshape" causes output mismatch
Issue
Running the single pass fuse_concat_into_reshape with onnxoptimizer 0.4.2 changes numerical outputs. One real model regresses after this pass only, while the original model runs correctly with the same oracle inputs.
Environment
- Ubuntu 20.04
- Python 3.10
- onnx==1.19.0
- onnxruntime==1.19.2
- onnxoptimizer==0.4.2 (latest)
Repro steps (run from this folder)
- Download and unzip the attached archive, then
cdinto the extracted directory
fuse_concat_into_reshape_repro.tar.gz
tar -xzvf fuse_concat_into_reshape_repro.tar.gz
cd fuse_concat_into_reshape_repro
- Create a Python 3.10 virtual environment and install dependencies:
python -m venv .venv source .venv/bin/activate pip install --upgrade pip pip install -r requirements.txt - Optimize the case with only
fuse_concat_into_reshape(writesmodel.opt.onnxnext tomodel.onnx):python optimize_model.py --case ./case_02937_seed43509122 - Differential test original vs optimized outputs using stored oracle inputs:
python diff_test.py --case ./case_02937_seed43509122
Observed results
- case_02937_seed43509122:
overall max_abs=1.221e-04,max_rel=9.756e-04; output drift on multiple tensors (see details below).
Expected
fuse_concat_into_reshape should be semantics-preserving. Applying this pass alone should not change any output values.
Differential Test Output Details
- case_02937_seed43509122
Case: case_02937_seed43509122
v17_0 (output[12]): max_abs=1.221e-04, max_rel=7.168e-04, shape=(2, 1, 16, 2)
v49_0 (output[17]): max_abs=1.221e-04, max_rel=9.756e-04, shape=(44, 1, 16, 46, 2)
Overall: max_abs=1.221e-04, max_rel=9.756e-04
Attachments
README.mdrequirements.txtoptimize_model.py(runs onlyfuse_concat_into_reshapeand saves optimized model asmodel.opt.onnx)diff_test.py(runs original and optimized model with same oracle inputs and reports their differences)run_optimized_model.py(runs the optimized model to inspect outputs)case_02937_seed43509122/(original model and oracle inputs for reproduction)
Metadata
Metadata
Assignees
Labels
No labels