Onnxruntime: SliceElimination transformer causes shape inference error

Created on 23 Apr 2019  路  7Comments  路  Source: microsoft/onnxruntime

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

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • ONNX Runtime installed from (source or binary): source or from https://test.pypi.org/project/ort-nightly/
  • ONNX Runtime version: 0.3.1
  • Python version: 3.6
  • Visual Studio version (if applicable):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

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.

bug

All 7 comments

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.

Issue fixed with #918.

Was this page helpful?
0 / 5 - 0 ratings