-
Notifications
You must be signed in to change notification settings - Fork 102
[BUG] The pass "eliminate_nop_expand" causes output mismatch #275
Copy link
Copy link
Open
Description
[BUG] The pass "eliminate_nop_expand" causes output mismatch
Issue
Running the single pass eliminate_nop_expand 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)
- 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_nop_expand(writesmodel.opt.onnxnext tomodel.onnx):
python optimize_model.py --case ./case_08971_seed91292368
- Differential test original and optimized models with same oracle inputs (ORT graph optimization disabled):
python diff_test.py --case ./case_08971_seed91292368
Expected
eliminate_nop_expand should be semantics-preserving. Applying this pass alone should not change any output values.
Differential Test Output Details
- case_08971_seed91292368 — output[1] max_abs=6.000e+00 max_rel=6.000e+08; output[5] max_abs=1.000e+00 max_rel=1.000e+00; overall mismatch.
Case: case_08971_seed91292368
output[0]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(1, 55, 1, 1, 1)
output[1]: max_abs=6.000e+00, max_rel=6.000e+08, shape=(2, 55, 2, 1, 2)
output[2]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(2, 55, 2, 1, 2)
output[3]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(41, 55, 2, 1, 2)
output[4]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(41, 55, 2, 1, 6)
output[5]: max_abs=1.000e+00, max_rel=1.000e+00, shape=(41, 55, 2, 1, 6)
output[6]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(40590,)
output[7]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(1,)
output[8]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(1, 1)
output[9]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(1,)
output[10]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(1, 1)
output[11]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(1,)
output[12]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(41, 55, 18, 1)
output[13]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(41, 55, 18, 1)
output[14]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(41, 55, 1, 1)
output[15]: max_abs=0.000e+00, max_rel=0.000e+00, shape=(41, 55, 1, 1)
Overall: max_abs=6.000e+00, max_rel=6.000e+08
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_08971_seed91292368/(original model and oracle inputs)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels