microsoft / microsoft/onnxruntime
[release 1.14] Scaler node get invalid input due to upstream (maybe ReduceMean) 's output is not expected
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the feature request
this is a bug.
repro:
1. extract the zip file (xd.zip, attached) to 'd:/backup/', will get onnx file and txt data file.
2. code:
```
from onnxruntime import InferenceSession
import numpy as np
Xd = np.loadtxt("d:/backup/xd.txt")
yd = np.array([0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 5, 5, 5,
0, 4, 1, 3, 5, 1, 0, 0, 2, 2, 2, 0, 1, 2, 3, 3, 3, 3, 4, 4, 1, 5,
0, 5, 2, 2, 0, 0])
onnx_model = "d:/backup/Scalar.onnx"
sess = InferenceSession(onnx_model, providers=["CPUExecutionProvider"])
output = sess.run(None, {'input': Xd.astype(np.float32)})
print(output)
```
Will failed in inference. the error message is:
test_utils.utils_backend.OnnxRuntimeAssertionError: Unable to run onnx due to [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running Scaler node. Name:'Scaler' Status Message: Either both scale and offset can be of feature size (1) or 1
onnx==1.13.0 onnxruntime==1.14.0 TARGET_OPSET=18
### Describe scenario use case
this is the onnx model file and test data:
[xd.zip](https://github.com/microsoft/onnxruntime/files/10672142/xd.zip)
Contributor guide
Research direction
Start by extracting xd.zip and reproducing the failure with the provided Python InferenceSession code using CPUExecutionProvider. Inspect the Scaler node and the upstream output, possibly ReduceMean, to determine why the scale and offset feature sizes do not satisfy the reported constraint. Done means the supplied model runs successfully or the invalid model is rejected with a clearer, correct diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100