Describe the issue
After upgrading from onnxruntime 1.23 to 1.26 one of our customers models fails to load with this error:
Load model from topk_repro.onnx failed:Node (/TopK) Op (TopK) [ShapeInferenceError] K input must be a one-dimensional tensor of size 1.
As far as I can tell this happens because there's a "Gather" operation that should give the required shape as input, but doesn't. I've reduced the model to just a toy example; the "Gather" operation here should be no-op but clearly its output type isn't as expected.
topk.py
To reproduce
on both Mac and Linux I can reproduce the problem with the attached script:
python3.14 -m venv ~/onnxruntime-env
source ~/onnxruntime-env/bin/activate
pip install onnx onnxruntime==1.26.0
python topk.py
Urgency
No response
Platform
Linux
OS Version
AlmaLinux 10.2
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
v1.26.0
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
Describe the issue
After upgrading from onnxruntime 1.23 to 1.26 one of our customers models fails to load with this error:
As far as I can tell this happens because there's a "Gather" operation that should give the required shape as input, but doesn't. I've reduced the model to just a toy example; the "Gather" operation here should be no-op but clearly its output type isn't as expected.
topk.py
To reproduce
on both Mac and Linux I can reproduce the problem with the attached script:
python3.14 -m venv ~/onnxruntime-env
source ~/onnxruntime-env/bin/activate
pip install onnx onnxruntime==1.26.0
python topk.py
Urgency
No response
Platform
Linux
OS Version
AlmaLinux 10.2
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
v1.26.0
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response