2

I'm converting a customized Pytorch model to ONNX. However, when loading it with ONNXRuntime, I've encountered an error as follows:

onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during initialization: ...onnxruntime/core/providers/cpu/tensor/transpose.h:46 onnxruntime::TransposeBase::TransposeBase(const onnxruntime::OpKernelInfo &) v >= 0 && static_cast<uint64_t>(v) <= std::numeric_limits<size_t>::max() was false.

I've checked with onnx.checker.check_model() and it's totally fine. I've also tried to replace transpose() into permute() in forward() function but the error has still remained.

Is anyone familiar with this error?

Environments:

Python 3.7
Pytorch 1.9.0
CUDA 10.2 
ONNX 1.10.1
ONNXRuntime 1.8.1 
OS Ubuntu 18.04

5
  • Can you share the ONNX file? Commented Aug 16, 2021 at 4:36
  • @SergiiDymchenko It's here (onnx file). Thank you in advance. Commented Aug 16, 2021 at 4:44
  • 1
    The perm attribute of node Transpose_52 is [-1, 0, 1] although ONNX Runtime requires that all of them should be positive: github.com/microsoft/onnxruntime/blob/… Commented Aug 16, 2021 at 5:06
  • Oh. Thank you a lot. I had thought that we only need to change from transpose() to permute() and don't need to pay attention to those indices. It makes sense now. Thank you @dkim. Commented Aug 16, 2021 at 5:11
  • @dkim Can you post in the term of an answer so that I can accept it? Commented Aug 16, 2021 at 5:12

1 Answer 1

3

The perm attribute of node Transpose_52 is [-1, 0, 1] although ONNX Runtime requires that all of them should be positive: onnxruntime/core/providers/cpu/tensor/transpose.h#L46

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.