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

Some models don't work in C++. #539

Open
c-m-k-miyoshi opened this issue Dec 25, 2023 · 2 comments
Open

Some models don't work in C++. #539

c-m-k-miyoshi opened this issue Dec 25, 2023 · 2 comments

Comments

@c-m-k-miyoshi
Copy link

I'm trying to run DirectML via onnxruntime, but some models don't work in C++ sample.

  • My exection environment
    • In C++
      • OnnxRuntime DirectML : version==1.15.1
      • DirectML : version==1.12.0
      • Graph optimization level : ORT_DISABLE_ALL
      • MemPattern : Disable
      • Execution mode : ORT_SEQUENTIAL
    • In Python
      • Python version==3.9.18
      • onnxruntime-directml==1.15.1

One of the models that does not work is the one below.

Code for model creation
import os
import torch
import torch.nn as nn

model_name_onnx = 'model_avg_512.onnx'

class simple_model(nn.Module):
    def __init__(self):
        super().__init__()
        self.avg_pool_01 = nn.AvgPool2d((2,2), stride=(2,2), padding=0)

    def forward(self, img):
        y0 = self.avg_pool_01(img)

        return y0

model = simple_model()

input0 = torch.tensor(torch.randint(255, size=(1, 1, 512, 512)), dtype=torch.float32)
y = model(input0)

input_names = ['input0']
output_names = ['output']
dynamic_axes = {'input0': {0: 'batch_size'}, 'output': {0: 'batch_size'}}

torch.onnx.export(
        model,
        (input0),
        model_name_onnx,
        export_params=True,
        opset_version=11,
        input_names=input_names,
        output_names=output_names,
    )
  • Input size: [1x1x512x512]
  • Layer information: single average_pool2d layer only
    • kernel_size: (2,2)
    • strides: (2,2)
    • padding: (0,0)
  • opset_version==11

The above model works fine with the Python sample, but it does not work with the C++ sample.
Also, the model with the input size changed to [1x1x256x256] works correctly with both Python and C++ samples.

Is this a known issue?
My goal is to make the model work with input size [1,1,1080,1920].

I'd be grateful for any help, thanks!

@JohnnyWang19921007
Copy link

@jstoecker
Good day!
My colleague @c-m-k-miyoshi faced this issue, if it's possible, may I check that there is any workaround or fix?
This issue will delay our customer Acer to release their latest AI PC, according to the schedule, this feature should be provided in the mid of Jan 2024.

@JohnnyWang19921007
Copy link

@jstoecker
May I check there is any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants