Giving input in NHWC format to tensor rt network in trt7

Description

i have an application in which i store image in cv::MAT objects, and since cv:MAT objects store images in NHWC format id like to give the raw data of cv::MAT as input rather than reformatting the data to NCHW. is it possible to change the input tensor format to NHWC cz in the dev guide, thers no mention of NHWC format. I’ve tried giving kCHW format in setAllowedformats but it didnt work.

Environment

TensorRT Version: 7
GPU Type: titan x pascal
Nvidia Driver Version: 450
CUDA Version: 11

Hi @gjraza,
Yes you can.
In C++, you can use ITensor::setAllowedFormats
https://docs.nvidia.com/deeplearning/tensorrt/api/c_api/classnvinfer1_1_1_i_tensor.html#abb6a8ccb84e2e4547371e10574a5bfb4
In Python,
you can use iTensor.allowed_formats
https://docs.nvidia.com/deeplearning/tensorrt/api/python_api/infer/Graph/LayerBase.html#tensorrt.ITensor

Thanks!