Should I retrain the model when the TensorRT uses NCHW as input and the pre-trained model uses NHWC format

Hello,

I want to convert my tensorflow model to tensorRT c++.

I has trained my model while the placeholder uses NHWC format. But when I read the user guide of TensorRT, it says the Input should always be NCHW format.

So should I rebuild and retrain the model with NCHW format?

Or I just need change the input from NHWC to NCHW. And the TensorRT engine will change the data format automatically  for loading weights and calculation?

Thank you!

I had also trained a model with input of NHWC format
[i]<tf.Tensor ‘image_input:0’ shape=(?, 300, 300, 3) dtype=float32>

[/i]Regardless of that TensorRT runs with input of NCHW format.

parser->registerInput("Input", DimsCHW(3, 300, 300), UffInputOrder::kNCHW);

it somehow controls the automatic conversion in TensorRT.