PyTorch 2.15 ONNX export with opset < 18 (ultralytics opset=12/17): 'No Adapter From Version $15 for Shape' or an INVALID_GRAPH 'Unrecognized attribute: num_outputs for operator Split'
Fix: don't ask for an opset below 18 with PyTorch 2.15's exporter. In ultralytics leave opset unset (and simplify off if in doubt): model.export(format="onnx", dynamic=False). Then run the result on onnxruntime 1.32, or rewrite the IR version for an older runtime.
What happens: the dynamo/onnxscript exporter only has implementations from opset 18, so it logs Setting ONNX exporter to use operator set version 18 because the requested opset_version 17 is a lower version than we have implementations for. Automatic version conversion will be performed, then falls back to the onnx C API version converter. With ultralytics 8.3.0 and no opset, it asked for opset 9 (ONNX: starting export with onnx 1.23.2 opset 9...), conversion failed with RuntimeError: ... adapter_lookup: Assertion false failed: No Adapter From Version $15 for Shape, and the model stayed at opset 18. That copy loads fine. With opset=17 the conversion "succeeded" and ultralytics reported export success, but onnxruntime 1.32.0 refused the file: [ONNXRuntimeError] : 10 : INVALID_GRAPH : ... In Node, ("node_Split_55", Split, ...) , Error Unrecognized attribute: num_outputs for operator Split. num_outputs is an opset-18 attribute on Split, so the down-converted graph is opset 17 with an opset-18 node. onnxslim 0.1.34 ran afterwards; the converter is the likely culprit, not onnxslim.
If an old runtime needs opset <= 17, likely options are an older torch/ultralytics pair (the TorchScript exporter) or validating every converted model with onnx.checker.check_model(m, full_check=True) before shipping. Always load the exported file once with onnxruntime in CI.