Open adepierre opened 1 year ago
Quick update : I tried to replace the Resize op doing a quick "custom nearest interpolate function", but it leads to a similar issue, this time with Concat node 🙁 I think the root cause might be the dynamic size of the input, but I don't really know how to investigate more the issue and even less fix it
import torch
def resize(x: torch.Tensor, scale_factor:int):
stacked_h = torch.stack([x]*scale_factor, dim=-1).view(*x.shape[:-1], scale_factor*x.shape[-1])
stacked = torch.stack([stacked_h]*scale_factor, dim=-2).view(*x.shape[:-2], scale_factor*x.shape[-2], scale_factor*x.shape[-1])
return stacked
class TestModel(torch.nn.Module):
def forward(self, x):
return resize(x, scale_factor=2)
model = TestModel()
example = torch.rand(1, 3, 256, 256)
torch.onnx.export(model,
example,
'test.onnx',
input_names=['inputs'],
export_params=True,
dynamic_axes={'inputs': {2 : 'height', 3: 'width'}}
)
[E:onnxruntime:, sequential_executor.cc:369 onnxruntime::SequentialExecutor::Execute] Non-zero status code returned while running Concat node. Name:'Concat_4' Status Message: D:\a\_work\1\s\onnxruntime\core\providers\dml\DmlExecutionProvider\src\MLOperatorAuthorImpl.cpp(1866)\onnxruntime.dll
Unfortunately having the same problem now in April 2023 :(
Same problem now in November 2024
Describe the issue
Trying to run a ONNX model with a Resize layer with DML results in this error message:
To reproduce
Model export with PyTorch :
Running the model in C++ (tested with Microsoft.ML.OnnxRuntime.DirectML.1.13.1.zip)
Urgency
Can't infer model with resize layers in DML, so it's quite blocking
Platform
Windows
OS Version
10
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.13.1
ONNX Runtime API
C++
Architecture
X64
Execution Provider
DirectML
Execution Provider Library Version
No response