TensorRT 5 vs 7 - output reversal

Hi,

May I know if there is a difference in the nvuffparser “registerOutput” function for TensorRT 7 vs TensorRT 5. I find that the order of the outputs are reversed when I use TensorRT 7.

I load the output Names as such.

image

I have 8 expected outputs. In TRT 5.1.5, the binding output size is as expected:
binding Index: 1
mTrtBindBufferSize_uff: 8
binding Index: 2
mTrtBindBufferSize_uff: 16
binding Index: 3
mTrtBindBufferSize_uff: 24
binding Index: 4
mTrtBindBufferSize_uff: 16
binding Index: 5
mTrtBindBufferSize_uff: 28
binding Index: 6
mTrtBindBufferSize_uff: 32
binding Index: 7
mTrtBindBufferSize_uff: 12
binding Index: 8
mTrtBindBufferSize_uff: 24

However, ever since I upgraded to TensorRT 7.0.0.11, the outputs seem to be in the reversed order.
binding Index: 1
mTrtBindBufferSize_uff: 24
binding Index: 2
mTrtBindBufferSize_uff: 12
binding Index: 3
mTrtBindBufferSize_uff: 32
binding Index: 4
mTrtBindBufferSize_uff: 28
binding Index: 5
mTrtBindBufferSize_uff: 16
binding Index: 6
mTrtBindBufferSize_uff: 24
binding Index: 7
mTrtBindBufferSize_uff: 16
binding Index: 8
mTrtBindBufferSize_uff: 8

The code is exactly the same for both implementations. I just linked the libraries accordingly.
TensorRTExpt1.cpp (8.3 KB)

Environment

TensorRT Version : 7.0.0.11 (and 5.1.5.0)
GPU Type : GTX 1060
Nvidia Driver Version : 26.21.14.4292
CUDA Version : 10.2
CUDNN Version : 7.6.5
Operating System + Version : Windows 10
Python Version (if applicable) : Python 3.6.6
TensorFlow Version (if applicable) : 1.5.0
PyTorch Version (if applicable) : 1.4.0
Baremetal or Container (if container which image + tag) :

Hi @ColinPs26kt,
Relying on the bindings to be in the same order of the registerOutput calls is not guaranteed by the API and the documentation of registerOutput does not state this either. We recommend you to find the binding index that matches each of your output name using the ICudaEngine::getBindingIndex() call. The latter API is available even in TRT-5.

Thanks!

Hi @AakankshaS,

Thanks for your suggestion. It has solved my issue.

Colin