Describe the bug
I'd like to test some object detection model on the latest runtime when it runs into a shape inference exception with the message:
RuntimeError: [ONNXRuntimeError] : 1 : GENERAL ERROR : [TypeInferenceError] Graph attribute inferencing failed: [ShapeInferenceError] Incompatible dimensions.
If I change back to runtime 0.3.0, everything will be fine.
You can find the model here: model. It's a part of Faster-RCNN model.
System information
To Reproduce
Describe steps/code to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
For any shape inference error, it's either a converter bug, or an ONNX bug. It's unlikely caused by onnxruntime code (unless the TypeInferenceError was thrown from a custom op node)
Do you know which op caused this error?
The issue doesn't look like it's an Onnx issue. The inference error was in a 'Div' op (which is confusing since there is no 'Div' in the graph). When I disable the graph transform 'EliminateSlice' it works without error.
Adding Ashwini since she knows about transforms and helped me to narrow it down.
Konstantinos is already looking into this
@lucienwang1009 you can turn off the transformers by setting the level to 0. Which API are you using?
CAPI: OrtSetSessionGraphOptimizationLevel(session_options, 0);
c# api: options.SetSessionGraphOptimizationLevel(0);
python: options.set_graph_optimization_level(0)
From an initial investigation, Slice Elimination is indeed causing the problem. As @askhade says, you can bypass this by setting the optimization level to 0.
Interestingly, the problem is not caused by the "visible" Slice in the top-level graph (this cannot be eliminated actually), but by a Slice that appears in a 74-node sub-graph (if I disable elimination in the subgraphs, it works). I will debug it later today.
PR https://github.com/Microsoft/onnxruntime/pull/918 fixes the issue.
Issue fixed with #918.