openvinotoolkit/openvino

[Bug]: Cannot get length of dynamic dimension

Open

#21,177 opened on Nov 20, 2023

View on GitHub
 (40 comments) (0 reactions) (1 assignee)C++ (3,229 forks)auto 404
category: transformationsgood first issuesupport_request

Repository metrics

Stars
 (10,286 stars)
PR merge metrics
 (Avg merge 14d 3h) (305 merged PRs in 30d)

Description

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.

Contributor guide