onnx-simplifier: ONNXRuntimeError

Hello,

I tried to convert my model but got error

onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Squeeze node. Name:'' Status Message: /onnxruntime_src/onnxruntime/core/providers/cpu/tensor/squeeze.h:47 static std::vector<long int> onnxruntime::SqueezeBase::ComputeOutputShape(const onnxruntime::TensorShape&, const onnxruntime::TensorShape&) input_shape[i] == 1 was false. Dimension of input 0 must be 1 instead of 2. shape={2,20,128}
Stacktrace:

I just follow your README to install onnx-simplifier, so the version of onnxruntime version shows 1.0.0 and version of onnx-simplifier is 0.2.2.

If I comment out https://github.com/daquexian/onnx-simplifier/blob/master/onnxsim/onnx_simplifier.py#L257 and https://github.com/daquexian/onnx-simplifier/blob/master/onnxsim/onnx_simplifier.py#L258. The error becomes

  File "/PATH.../onnxruntime/capi/session.py", line 37, in _load_model
    self._sess.read_bytes(self._path_or_bytes, providers)
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : [ShapeInferenceError] Dimension of input 0 must be 1 instead of 2

How can I get rid of this error? Thank you.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 1
  • Comments: 26 (10 by maintainers)

Most upvoted comments

@daquexian 如果我把squeeze操作修改成等价的view有可能修复这个问题吗

当我将pytorch换成1.8的时候,这个问题消失了。 但在pytorch1.6-1.7版本都存在这个问题

  • Pytorch-1.8.0
  • ONNX-1.7.0
  • ONNXRuntime-1.7.0

@daquexian Sent. Thank you!