-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
The pass "eliminate_shape_op" causes output mismatch
Issue
eliminate_shape_op (onnxoptimizer 0.4.2) causes output drift in a subset of filtered non-ok cases even when ORT graph optimizations are disabled. case_03181_seed45441358 shows mismatches (v4_0, v25_0), and case_05898_seed66957281 shows NaN mismatches (v14_0).
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 below, then
cdinto the extracted directory
eliminate_shape_op_repro.tar.gz
tar -xzvf eliminate_shape_op_repro.tar.gz
cd eliminate_shape_op_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 each case with only
eliminate_shape_op:
python optimize_model.py --case case_03181_seed45441358
- Run the differential test (ORT optimizations disabled) to compare optimized vs reference:
python diff_test.py --case case_03181_seed45441358
Expected
eliminate_shape_op should be semantics-preserving; applying the pass alone should not change any output values.
Differential Test Output Details
- case_03181_seed45441358
Case: case_03181_seed45441358
Mismatched outputs (optimized vs reference):
v4_0 (output[11]): max_abs=3.352e+00, max_rel=6.005e-01, shape=(1, 135, 17)
v25_0 (output[12]): max_abs=5.664e+00, max_rel=4.489e+00, shape=(57, 45, 17)
Overall: max_abs=5.664e+00, max_rel=4.489e+00
Attachments
README.md(this document)requirements.txt(dependency versions)optimize_model.py(runs onlyfuse_consecutive_squeezesand savesmodel.opt.onnx)diff_test.py(runs original vs optimized with oracle inputs and reports max_abs/max_rel)case_03181_seed45441358/(containsmodel.onnxoriginal model,oracle.pklinput data for both original and optimized models)
Metadata
Metadata
Assignees
Labels
No labels