nguyendhn
nguyendhn

Reputation: 543

Error in loading ONNX model with ONNXRuntime

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

Upvotes: 2

Views: 19034

Answers (1)

dkim
dkim

Reputation: 3970

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

Upvotes: 3

Related Questions