Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Dimension of data input shape along 'axis': 7 must be evenly divisible by 'num_splits' attribute value: 4 #21175

Open
3 tasks done
jikechao opened this issue Nov 20, 2023 · 5 comments
Assignees
Labels
category: ONNX FE OpenVINO ONNX FrontEnd good first issue Good for newcomers support_request

Comments

@jikechao
Copy link

OpenVINO Version

openvino-nightly 2023.2.0.dev20231101

Operating System

Ubuntu 18.04 (LTS)

Device used for inference

CPU

Framework

ONNX

Model used

https://github.com/jikechao/onnx_models/blob/main/Split.onnx

Issue description

image

For the special case, ONNXRuntime can support it and give correct calculation results. However, the conversion from ONNX to OV IR crashed. This is caused by incorrect constraint checking, like Dimension of data input shape along 'axis': 7 must be evenly divisible by 'num_splits' attribute value: 4

Step-by-step reproduction

download the given model and convert it to OV IR.

import openvino as ov

onnx_model_path = 'Split.onnx'
ov_model = ov.convert_model(onnx_model_path)

Relevant log output

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    ov_model = ov.convert_model(onnx_model_path)
  File "C:\software\conda\envs\torch\lib\site-packages\openvino\tools\ovc\convert.py", line 101, in convert_model
    ov_model, _ = _convert(cli_parser, params, True)
  File "C:\software\conda\envs\torch\lib\site-packages\openvino\tools\ovc\convert_impl.py", line 524, in _convert
    raise e
  File "C:\software\conda\envs\torch\lib\site-packages\openvino\tools\ovc\convert_impl.py", line 476, in _convert
    ov_model = driver(argv, {"conversion_parameters": non_default_params})
  File "C:\software\conda\envs\torch\lib\site-packages\openvino\tools\ovc\convert_impl.py", line 226, in driver
    ov_model = moc_emit_ir(prepare_ir(argv), argv)
  File "C:\software\conda\envs\torch\lib\site-packages\openvino\tools\ovc\convert_impl.py", line 172, in prepare_ir
    ov_model = moc_pipeline(argv, moc_front_end)
  File "C:\software\conda\envs\torch\lib\site-packages\openvino\tools\ovc\moc_frontend\pipeline.py", line 247, in moc_pipeline
    ov_model = moc_front_end.convert(input_model)
  File "C:\software\conda\envs\torch\lib\site-packages\openvino\frontend\frontend.py", line 18, in convert
    converted_model = super().convert(model)
RuntimeError: Check 'error_message.empty()' failed at src\frontends\onnx\frontend\src\frontend.cpp:124:
Errors during ONNX translation: 
While validating ONNX node '<Node(Split): output_1, output_2, output_3, output_4>':
Check 'dimension_at_axis % num_splits == 0' failed at src\core\shape_inference\include\split_shape_inference.hpp:62:
While validating node 'opset1::Split Split_3 (input[0]:f32[7], Constant_2[0]:i64[]) -> (dynamic[...])' with friendly_name 'Split_3':
Dimension of data input shape along 'axis': 7 must be evenly divisible by 'num_splits' attribute value: 4

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
  • There is reproducer code and related data files such as images, videos, models, etc.
@jikechao jikechao added bug Something isn't working support_request labels Nov 20, 2023
@andrei-kochin andrei-kochin added the category: ONNX FE OpenVINO ONNX FrontEnd label Nov 20, 2023
@avitial avitial removed the bug Something isn't working label Nov 27, 2023
@jikechao
Copy link
Author

jikechao commented Dec 1, 2023

@avitial @andrei-kochin @gkrivor This issue has been open for more than 2 weeks, Could you help me a look?

From my perspective, ONNXRuntime can accept this behavior while OV cannot, we should correct the 'Split' operator in OV to keep it aligned with ONNXRuntime.

Wish your reply! Thank you!

@andrei-kochin
Copy link
Contributor

@jikechao appreciate your patience!

I agree that current behavior is not aligned with ONNX RT but what can help us to prioritize this issue higher is that if you can find some real model in public which suffers from this issue. As per pool of existing models in our validation and other known models we don't see similar cases so we consider this bug as the corner case which doesn't require immediate actions.

Currently we are focused on higher priority activities. Could you please provide some justification to increase the priority if you think that it is critical? And of course there is always a way to contribute the fix for this on your own and we can assist you with it.

Thank you!

@andrei-kochin
Copy link
Contributor

andrei-kochin commented May 6, 2024

Currently ONNX RT allows invalid dimensions for Split op even if tensor size is not possible to be divided while OpenVINO doesn't allow that

>>> input
array([1.7858912e+31, 2.9642022e+29, 1.5645358e+04, 7.2249586e+28,
       1.0102059e-38, 0.0000000e+00, 0.0000000e+00], dtype=float32)
>>> sess.run([], {'input': input})
[
array([1.7858912e+31, 2.9642022e+29], dtype=float32), 
array([1.5645358e+04, 7.2249586e+28], dtype=float32),
array([1.0102059e-38, 0.0000000e+00], dtype=float32),
array([0.], dtype=float32)
]

@FReakYdiVi
Copy link

.take

Copy link
Contributor

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

@p-wysocki p-wysocki moved this from Contributors Needed to Assigned in Good first issues Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: ONNX FE OpenVINO ONNX FrontEnd good first issue Good for newcomers support_request
Projects
Status: Assigned
Development

No branches or pull requests

5 participants