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]: Cannot get length of dynamic dimension #21177

Open
3 tasks done
jikechao opened this issue Nov 20, 2023 · 7 comments
Open
3 tasks done

[Bug]: Cannot get length of dynamic dimension #21177

jikechao opened this issue Nov 20, 2023 · 7 comments
Assignees
Labels
category: transformations OpenVINO Runtime library - Transformations 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/Pads.onnx

Issue description

The conversion of the Pads operator from ONNX failed unexpectedly and threw "Cannot get length of dynamic dimension".
The model structure is shown below:
image

Step-by-step reproduction

import openvino as ov
import numpy as np
import onnxruntime as ort
onnx_model_path = 'Pads.onnx'
session = ort.InferenceSession(onnx_model_path)

x = np.random.random([1, 3, 4, 5]).astype(np.float32)
pads = np.random.randint(0, 2, size=[8], dtype=np.int64)
input_data = {"x": x, "pads": pads}
output_name = session.get_outputs()[0].name
onnx_output = session.run(None, input_data)

ov_model = ov.convert_model(onnx_model_path)  # crash

Relevant log output

Traceback (most recent call last):
  File "test.py", line 14, 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\moc_frontend\moc_emit_ir.py", line 18, in moc_emit_ir
    apply_moc_transformations(ngraph_function, cf=False, smart_reshape=True)
RuntimeError: Exception from src\core\src\dimension.cpp:233:
Cannot get length of dynamic dimension

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
@ilya-lavrenov ilya-lavrenov 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
@heebahsaleem
Copy link

Is this issue resolved? I am getting the same issue

@jikechao
Copy link
Author

@heebahsaleem This problem still exists and has not been resolved yet.
@avitial @ilya-lavrenov could you help us investigate this issue?

@wenjiew
Copy link

wenjiew commented Jan 3, 2024

@gkrivor a kind reminder to take a look into this issue. Thanks!

@andrei-kochin
Copy link
Contributor

@jikechao @heebahsaleem issue can be workaround-ed if you use compile_model call directly without converting the model to IR. Seems like an issue in the transformation pipeline so I summon @itikhono to assign someone to take a look

>>> m = c.read_model("pads.onnx")
>>> m
<Model: 'Pad'
inputs[
<ConstOutput: names[x] shape[1,3,4,5] type: f32>,
<ConstOutput: names[pads] shape[8] type: i64>
]
outputs[
<ConstOutput: names[y] shape[?,?,?,?] type: f32>
]>

>>> c.compile_model(m)
<CompiledModel:
inputs[
<ConstOutput: names[x] shape[1,3,4,5] type: f32>,
<ConstOutput: names[pads] shape[8] type: i64>
]
outputs[
<ConstOutput: names[y] shape[?,?,?,?] type: f32>
]>

@andrei-kochin andrei-kochin added category: transformations OpenVINO Runtime library - Transformations and removed category: ONNX FE OpenVINO ONNX FrontEnd labels May 6, 2024
@andrei-kochin andrei-kochin added the good first issue Good for newcomers label May 6, 2024
@Plomo-02
Copy link

hello, Is it possible being assigned to this issue?

@jikechao
Copy link
Author

jikechao commented Aug 26, 2024

@andrei-kochin Thanks for your explanation.

@Plomo-02 Can you open a PR to fix it? Many thanks!

@andrei-kochin
Copy link
Contributor

@Plomo-02 you are now assigned if you are still interested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: transformations OpenVINO Runtime library - Transformations good first issue Good for newcomers support_request
Projects
Status: Assigned
Development

No branches or pull requests

9 participants