Skip to content

[BUG] The Pass “eliminate_nop_pad causes“ output mismatch #261

@C1ri007

Description

@C1ri007

Issue
eliminate_nop_pad (onnxoptimizer 0.4.2) produces numerical differences between the optimized graph and oracle in case_02937_seed43509122. Only output tensors v17_0 (output[12]) and v49_0 (output[17]) differs.

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)

  1. Download and unzip the attached archive below, then cd into the extracted directory

eliminate_nop_pad_repro.tar.gz

tar -xzvf eliminate_nop_pad_repro.tar.gz
cd eliminate_nop_pad_repro
  1. 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
  1. Optimize the problematic case with only eliminate_nop_pad:
python optimize_model.py --case case_02937_seed43509122
  1. Run the differential test to compare the optimized graph vs the oracle with ORT optimizations disabled:
python diff_test.py --case case_02937_seed43509122

Expected
All outputs should match the reference so diff_test.py prints “All outputs matched exactly.” NaN-laden tensors in other cases may trigger numpy warnings, but those are irrelevant because only case_02937 is being evaluated here, and disabling ORT graph optimizations keeps constant-fold warnings out of the log.

Differential Test Output Details

Case: case_02937_seed43509122
Mismatched outputs (optimized vs reference):
  v17_0 (output[12]): max_abs=1.221e-04, max_rel=7.163e-04, shape=(2, 1, 16, 2)
  v49_0 (output[17]): max_abs=1.221e-04, max_rel=9.747e-04, shape=(44, 1, 16, 46, 2)
Overall: max_abs=1.221e-04, max_rel=9.747e-04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions