Open SaverioFrancesco opened 1 year ago
For this TopK, looks like the issue is that there are fewer than K things to choose from. An error seems reasonable. The ONNX spec doesn't specify what should happen in this case. https://github.com/onnx/onnx/blob/45f508bb7c3206cf504b923d54076e42d1ed591c/docs/Operators.md#topk
Describe the issue
Description
I get the following error
onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running TopK node. Name:'TopK_6271' Status Message: /onnxruntimesrc/onnxruntime/core/providers/cuda/math/topk.cc:64 onnxruntime::common::Status onnxruntime::cuda::TopK::ComputeInternal(onnxruntime::OpKernelContext*) const [with bool inputk = true] K >= 0 && K_ <= tensor_X->Shape().GetDims()[axis] was false.
while running
self.ort_session.run( None, {"input1" : images} )
on CUDAExecutionProvider
On the attached onnx model based on the SSDMobilenet
torchvision.models.detection.ssdlite320_mobilenet_v3_large
The files
ssdlite.zip
Other information
By running
python3.9 -m onnxruntime.tools.check_onnx_model_mobile_usability --log_level debug modules/hand_gestures_recognition/ssdlite.onnx
I get the following:
To compile the onnx from scratch (Optional)
To reproduce
assert 'CUDAExecutionProvider' in onnxruntime.get_available_providers() sess_options = onnxruntime.SessionOptions() session = onnxruntime.InferenceSession(export_model_path, providers=['CUDAExecutionProvider'])
random_dummy_input = torch.randn(8, 3, 320, 320).numpy() # this dose not get any errors
real_input= images # TODO: the numpy array where it fails. Load this form the file attached.
results = session.run( None, {"input1" : real_input} )
Urgency
No response
Platform
Linux
OS Version
Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.13.1
ONNX Runtime API
Python
Architecture
X64
Execution Provider
CUDA
Execution Provider Library Version
CUDA Version: 11.7
Update [11:46 Wednesday, December 7, 2022 (GMT+1)]:
Running on CPUExecutionProvider I obtain the a similar error. Maybe this is more clear.
Apparently on that input the TopK recive a K=4 on but got a tensor containing shape 3