microsoft / microsoft/onnxruntime
Could not find an implementation for Conv for opset 11 and data type "double"
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the issue
Can not run import model (exported by pytorch.onnx.export) by onnx run time method ort.InferenceSession.
Below error is generated:

### To reproduce
The code to export pytorch model:
import torch
import network.herbs.timm as timm
from network.herbs.models.pim_module.pim_module import PluginMoodel
from export_config import export_config_file
def export_herbs_onnx(input_model_path: str, output_model_path: str):
inputs = (1, 3, 384, 384)
num_selects = {'layer1': 256, 'layer2': 128, 'layer3': 64, 'layer4': 32}
num_class = 200
backbone = timm.create_model('swin_large_patch4_window12_384_in22k', pretrained=False)
model = PluginMoodel(backbone=backbone,
return_nodes=None,
img_size=384,
use_fpn=True,
fpn_size=1536,
proj_type="Linear",
upsample_type="Conv",
use_selection=True,
num_classes=num_class,
num_selects=num_selects,
use_combiner=True,
comb_proj_size=None)
checkpoint = torch.load(input_model_path, map_location=torch.device('cpu'))
model.load_state_dict(checkpoint['model'])
model.eval()
output_names = ['FPN1_layer4', 'FPN1_layer3', 'FPN1_layer2', 'FPN1_layer1', 'layer1', 'layer2', 'layer3', 'layer4',
'select_layer1', 'drop_layer1', 'select_layer2', 'drop_layer2', 'select_layer3', 'drop_layer3',
'select_layer3', 'drop_layer3',
'comb_outs']
model.double()
inputs = inputs.double()
torch.onnx.export(model, inputs, output_model_path,
input_names=["input"], output_names=output_names,
export_params=True,
opset_version=15)
--------------------------------------------------------------------------------------
The code to import onnx model:
import onnxruntime as ort
sess = ort.InferenceSession(model_path,providers=['CPUExecutionProvider'])
### Urgency
_No response_
### Platform
Windows
### OS Version
windows 11
### ONNX Runtime Installation
Built from Source
### ONNX Runtime Version or Commit ID
onnxruntime-1.17.1
### ONNX Runtime API
Python
### Architecture
X64
### Execution Provider
Default CPU
### Execution Provider Library Version
_No response_
Contributor guide
Research direction
Start by running the supplied PyTorch export and ort.InferenceSession reproduction with ONNX Runtime 1.17.1 and the CPU provider, checking the exported model's actual opset and Conv data type. The screenshot contains the only detailed error, so confirm the failure from a minimal model; done means determining whether Conv with double is supported and adding the appropriate fix or regression coverage if a code change is required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100