Error when converting the ONNX model to TensorRT

Hi, I am trying to convert the pretrained GAST Network (27_frame_model.bin) to tensorrt through onnx.

The conversion from pytorch to onnx seems to be OK using this code:
x = torch.randn(2,102 , 17, 2) torch.onnx.export(model, x, "GASTNet3_onnx.onnx", verbose=True, opset_version=11)

But when converting onnx to trt either with trtexec or trt python API or trt C ++ API, I get the following error:

[09/29/2020-17:44:53] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [09/29/2020-17:44:53] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [09/29/2020-17:44:53] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [09/29/2020-17:44:53] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [09/29/2020-17:44:53] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [09/29/2020-17:44:53] [I] [TRT] (Unnamed Layer* 8) [Matrix Multiply]: broadcasting input1 to make tensors conform, dims(input0)=[2,100,17,128][NONE] dims(input1)=[1,1,128,128][NONE]. [09/29/2020-17:44:53] [I] [TRT] (Unnamed Layer* 13) [Matrix Multiply]: broadcasting input1 to make tensors conform, dims(input0)=[2,100,17,128][NONE] dims(input1)=[1,1,128,128][NONE]. [09/29/2020-17:44:53] [E] [TRT] Cast_13: invalid weights type of Bool [09/29/2020-17:44:53] [W] [TRT] onnx2trt_utils.cpp:198: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [09/29/2020-17:44:53] [E] [TRT] Cast_13: invalid weights type of Bool [09/29/2020-17:44:53] [E] [TRT] Cast_13: invalid weights type of Bool [09/29/2020-17:44:53] [E] [TRT] Cast_13: invalid weights type of Bool [09/29/2020-17:44:53] [E] [TRT] Cast_13: invalid weights type of Bool [09/29/2020-17:44:53] [E] [TRT] Cast_13: invalid weights type of Bool [09/29/2020-17:44:53] [E] [TRT] Cast_13: invalid weights type of Bool While parsing node number 17 [Unsqueeze]: ERROR: onnx2trt_utils.cpp:169 In function convertAxis: [8] Assertion failed: axis >= 0 && axis < nbDims [09/29/2020-17:44:53] [E] Failed to parse onnx file [09/29/2020-17:44:53] [E] Parsing model failed [09/29/2020-17:44:53] [E] Engine creation failed [09/29/2020-17:44:53] [E] Engine set up failed &&&& FAILED TensorRT.trtexec # /TensorRT-7.1.3.4.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn8.0/TensorRT-7.1.3.4/bin/trtexec --onnx=GASTNet3_onnx.onnx --explicitBatch --saveEngine=GASTNet.engine

If I understood correctly, the problem is on value axis parameter of Unsqueeze_17 layer, however the previous unsqueeze layers don’t generate any error.

Environment

TensorRT Version: 7.1.3.4
GPU Type: GTX 1080
Nvidia Driver Version: 430
CUDA Version: 10.2
CUDNN Version: 8.0
Operating System + Version: Ubuntu 18.04
**Python Version **: 3.6.8
PyTorch Version (if ap: 1.6.0
Onnx version: 1.7.0
Opset version: 11

How to solve this problem? Thanks in advance!

Hi @aelkaid,
Could you please share the onnx model and script to reproduce the issue so we can help better?

Thanks

Hi @aelkaid,
Looking at the ONNX graph, it seems model has float64 type, which TRT does not support.
Could you please export using float32 and let us know in case issue persist?

Thanks