-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
[BUG] The pass "eliminate_shape_gather" causes output mismatch
Issue
Running the single pass eliminate_shape_gather with onnxoptimizer 0.4.2 changes numerical outputs.
Environment
- Ubuntu 20.04
- Python 3.10
- onnx==1.19.0
- onnxruntime==1.23.2
- onnxoptimizer==0.4.2(latest)
Repro steps (run from this folder)
eliminate_shape_op_repro.tar.gz
- Create a Python environment (Python 3.10) and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
- Optimize a case with only
eliminate_shape_gather(writesmodel.opt.onnxnext tomodel.onnx):
python optimize_model.py --case ./case_03140_seed45116679
- Differential test original and optimized models with the same oracle inputs (ORT graph optimization disabled):
python diff_test.py --case ./case_03140_seed45116679
Expected
eliminate_shape_gather should be semantics-preserving. Applying this pass alone should not change any output values.
Differential Test Output Details
- case_03140_seed45116679 — mismatch; output[14] max_abs=4.022e+04 max_rel=4.022e+12, output[15] max_abs=5.190e+02 max_rel=5.120e+10; overall mismatch.
- case_05413_seed63116566 — mismatch; output[12] max_abs=4.572e+10 max_rel=1.322e+11; overall mismatch.
Case: case_03140_seed45116679 (ORT graph optimizations disabled)
output[14]: max_abs=4.022e+04, max_rel=4.022e+12, shape=(1, 21, 24)
output[15]: max_abs=5.190e+02, max_rel=5.120e+10, shape=(32, 21, 24)
Overall: max_abs=4.022e+04, max_rel=4.022e+12
Case: case_05413_seed63116566 (ORT graph optimizations disabled)
output[12]: max_abs=4.572e+10, max_rel=1.322e+11, shape=(44, 1, 52, 14, 1)
Overall: max_abs=4.572e+10, max_rel=1.322e+11
Attachments
requirements.txtoptimize_model.pydiff_test.py(runs original and optimized with same oracle inputs; ORT graph optimizations disabled)run_optimized_model.py(executes optimized model with oracle inputs)case_03140_seed45116679/,case_05413_seed63116566/, (original models and oracle inputs)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels