Does TensorRT 3.0 C++ API only works for NCHW?

I was trying to use TensorRT 3.0 on TX2 to accelerate DNN model running. I have converted my Tensorflow model to UFF models successfully. And the results of native tensorflow (pb) and UFF (python API) are very similar. However, when I tried C++ API, it didn’t return the correct result. One thing I noticed is in C++ API, you have to register the input in CHW. so does the C++ API only works for network trained in NCHW format? thanks

Hi hondga.mao, although networks can use NHWC and NCHW, TensorFlow users are encouraged to convert their networks to use NCHW data ordering explicitly in order to achieve the best possible performance. TensorRT’s C++ API input and output tensors are in NCHW format.

@dusty_nv, thanks for your answer. I just want to make sure NHWC networks work with C++ API

@dusty_nv one thing I’m still confused is: isn’t the format of input and output tensor defined by tensorflow when generating the pb file or uff file?


Yes. The input format is chosen in the Tensorflow model definition.
UFF and TensorRT engine just parse it into the corresponding type.