I have several doubts regarding regarding the TensorRT Onnx model parser . I am using a system with:
- Ubuntu: 16.04
- CUDA: 9.0
- CuDnn: 7.3
- TensorRT: 5.1
- Nvidia Driver: 386
The error can be found at this link(snapshot), also attached:
I have tried opset_8 and opset_9 versions.
Question 1: Which version of opset is supported with TensorRT 5.1 for ONNX parser ? For TensorRT 5.0 opset_7 is recommended ? Is it the same for TensorRT 5.1.
Question 2: In TensorRT 5.1 Cast operation is already been added as supported operation so why I could not parse this model. I receive error for Cast operation parsing.
Thankyou.

Here is the output that I get when using opset7
(Ignore the name of the files. I have modified sample_onnx_mnist for quick try)
root@TAG01164:/TensorRT-5.1.2.2/bin# ./sample_onnx_mnist
&&&& RUNNING TensorRT.sample_onnx_mnist # ./sample_onnx_mnist
Input filename: …/…/…/data/mnist/opset7.onnx
ONNX IR version: 0.0.4
Opset version: 7
Producer name: tf2onnx
Producer version: 1.5.0
Domain:
Model version: 0
Doc string:
WARNING: ONNX model has a newer ir_version (0.0.4) than this parser was built against (0.0.3).
While parsing node number 0 [Cast]:
ERROR: builtin_op_importers.cpp:703 In function importCast:
[8] Assertion failed: inputs.at(0).is_tensor()
[E] Failure while parsing ONNX file
&&&& FAILED TensorRT.sample_onnx_mnist # ./sample_onnx_mnist
sample_onnx_mnist: sampleOnnxMNIST.cpp:162: int main(int, char**): Assertion `trtModelStream != nullptr’ failed.
Aborted (core dumped)
I also met the similar problem when I try to convert a resnet50 model from pytorch to tensorrt:
Input filename: resnet50_opset_7.onnx
ONNX IR version: 0.0.3
Opset version: 7
Producer name: pytorch
Producer version: 0.4
Domain:
Model version: 0
Doc string:
Parsing model
While parsing node number 174 [Cast -> “494”]:
ERROR: /root/robotics/onnx-tensorrt-build/onnx-tensorrt/builtin_op_importers.cpp:630 In function importCast:
[8] Assertion failed: inputs.at(0).is_tensor()
Emmm, I found that tensorrt don’t support AdaptiveAvgPool2d, and when I removed the last two layers of resnet50 (global avg pooling and fc) the convert-op is succeed.