I am trying to deploy onnx model using tensorrt, but cannot find tensorrt support for int64 data type.
nvinfer1::ITensor supprts the following types
kFLOAT FP32 format.
kHALF FP16 format.
kINT8 INT8 format.
kINT32 INT32 format.
In the onnx model exported from pytorch, I have several usages of int64
Any thoughts on how to address that? Should we modify pytorch export to avoid int64? Assume
we never use a number > 2G? Or should we add that into onnx-tensorrt ?
If your data fit into int32, I think you can just convert them to int64, especially for shapes. :| I think it didn't make sense to export dimensions as int64 in the first place...
I am very very puzzled. Seems we cannot avoid using int64 in PyTorch code, like shape operation, reshape (view) operation.
You solve the question?when inference faceboxes of pytorch with onnx-tensorrt ,I have the same question.
error:
Input filename: /home/tao/useful/faceboxes_tensorrt_cuda/src/faceboxes_v1.onnx
ONNX IR version: 0.0.3
Opset version: 9
Producer name: pytorch
Producer version: 0.4
Domain:
Model version: 0
Unsupported ONNX data type: INT64 (7)
ERROR: Parameter check failed at: ../builder/Layers.cpp::ConstantLayer::1585, condition: weights.type == DataType::kFLOAT || weights.type == DataType::kHALF || weights.type == DataType::kINT32
While parsing node number 100 [Gather]:
ERROR: onnx2trt_utils.hpp:275 In function convert_axis:
[8] Assertion failed: axis >= 0 && axis < nbDims
ERROR: failed to parse onnx file
any updates about this data type problem ? Thanks.
if you have some ops like this:
o.view(o.size(0), -1) please change to o.view(int(o.size(0)), -1). It worked for me.
@yanhn thank you ,your solution works.
@yanhn Thank you so much, It worked for me too!
TensorRT currently doesn't have plans to support INT64 types. In later TRT versions, (>=7.0) we downcast INT64 to INT32 in TensorRT, as most frameworks use INT64 type for indexing when converting to ONNX.
Closing this issue.
Most helpful comment
if you have some ops like this:
o.view(o.size(0), -1)please change too.view(int(o.size(0)), -1). It worked for me.