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]: Argument element types do not match (input arg element type: i64, arg_pad element type: f32) #21071

Closed
3 tasks done
jikechao opened this issue Nov 14, 2023 · 1 comment
Assignees
Labels
bug Something isn't working category: PyTorch FE OpenVINO PyTorch Frontend

Comments

@jikechao
Copy link

OpenVINO Version

openvino-nightly 2023.2.0.dev20231101

Operating System

Ubuntu 18.04 (LTS)

Device used for inference

CPU

Framework

PyTorch

Model used

Given in the following script

Issue description

If the input type of avg_pool1d operator is set as 'torch.int64', PyTorch can run well. However, when converting the model to OpenVINO, it crashed. The crash message is shown below.

Step-by-step reproduction

import torch
from torch.nn import Module
import openvino as ov


class avg_pool1d(Module):
    def forward(self, *args):
        return torch.nn.functional.avg_pool1d(args[0], kernel_size=2)


input_data = torch.randint(1, 10, [1, 2, 3], dtype=torch.int64)
torch_model = avg_pool1d().float().eval()
torch_outputs = torch_model(input_data).cpu().numpy()

trace = torch.jit.trace(torch_model, input_data)
trace = torch.jit.freeze(trace)

input_shapes = input_data.shape
ov_model = ov.convert_model(trace, example_input=input_data)

Relevant log output

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    ov_model = ov.convert_model(trace, example_input=input_data)
  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)
openvino._pyopenvino.OpConversionFailure: Check 'is_conversion_successful' failed at src/frontends/pytorch/src/frontend.cpp:140:
FrontEnd API failed with OpConversionFailure:
Model wasn't fully converted. Failed operations detailed log:
-- aten::avg_pool1d with a message:
Exception happened during conversion of operation aten::avg_pool1d with schema aten::avg_pool1d(Tensor self, int[1] kernel_size, int[1] stride=[], int[1] padding=[0], bool ceil_mode=False, bool count_include_pad=True) -> Tensor
Check 'element::Type::merge(result_et, result_et, arg_pad_element_type)' failed at src/core/src/op/util/pad_base.cpp:80:
While validating node 'opset1::Pad Pad_18 (1[0]:i64[?,?,?], aten::avg_pool1d/Concat[0]:i32[3], aten::avg_pool1d/Concat[0]:i32[3], aten::avg_pool1d/Constant[0]:f32[]) -> (dynamic[...])' with friendly_name 'Pad_18':
Argument element types do not match (input arg element type: i64, arg_pad element type: f32).

Summary:
-- Conversion is failed for: aten::avg_pool1d

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.
@mvafin
Copy link
Contributor

mvafin commented Nov 16, 2023

Thank you for the ticket. PR #21139 should fix the issue.

@avitial avitial added category: PyTorch FE OpenVINO PyTorch Frontend and removed support_request labels Nov 17, 2023
@mvafin mvafin closed this as completed Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working category: PyTorch FE OpenVINO PyTorch Frontend
Projects
None yet
Development

No branches or pull requests

3 participants