Open
Description
Describe the issue
For the following onnx model,
the shape of result should be 1x3x1x1. But onnxruntime produces wrong shape of results, 1x3x1x3. The outputs are as follows:
ONNXRuntime:
[array([[[[0.0192995 , 0.0192995 , 0.0192995 ]],
[[0.00301902, 0.00301902, 0.00301902]],
[[0. , 0. , 0. ]]]], dtype=float32)]
shape:
(1, 3, 1, 3)
According to the specification of clip operator, the results' shape of clip should be identical to that of the its inputs. So, in this issue, it is strange that why the results' shape is 1x3x1x3.
To reproduce
Environment
OS: Ubuntu 20.04
onnxruntime: 1.23.0.dev20250515001
CUDA: cuda-12.2.2::cuda-toolkit
CUDNN: 9.1.1.17
NVIDIA GPU: GeForce RTX 3080
NVIDIA Driver Version: 535.183.01
Python Version: 3.12.9
Steps to reproduce
This bug can be reproduced by the following code with the model in the attachment.
import sys
import os
import numpy as np
import onnx
import onnxruntime
import pickle
def main():
onnx_model = onnx.load("111.onnx")
with open("inputs.pkl", "rb") as fp:
inputs = pickle.load(fp)
try:
ort_session = onnxruntime.InferenceSession(
onnx_model.SerializeToString(), providers=["CPUExecutionProvider"]
)
ort_output = ort_session.run([], inputs)
except Exception as e:
print(e)
sys.exit(1)
print("ONNXRuntime:\n", ort_output)
print("shape:\n", ort_output[0].shape)
if __name__ == "__main__":
main()
Urgency
No response
Platform
Linux
OS Version
Ubuntu 20.04
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.23.0.dev20250515001
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
Metadata
Metadata
Assignees
Labels
No labels