Can't use NHWC format in TensorRT 7.2.2/7.2.3


I am creating a simple network using INetworkDefinition consisting of one PluginV2DynamicExt. This plugin/network has two inputs - one is 4 dimensional (NHWC) FP32 tensor, and another is 2 dimensional FP32 tensor. In plugin I implement supportsFormatCombination as follows:

bool ProjectiveTransformPlugin::supportsFormatCombination(int pos,
                                                          const nvinfer1::PluginTensorDesc* inOut,
                                                          int nbInputs, int nbOutputs) {

  if ((pos == 0) || (pos == 2)) {
    auto format = inOut[pos].format;
    return (format == nvinfer1::TensorFormat::kHWC) || (format == nvinfer1::TensorFormat::kHWC8);
  } else if (pos == 1) {
    return inOut[pos].type == nvinfer1::DataType::kFLOAT;
  return true;

When I try to build network I get the following error:

(Unnamed Layer* 0) [PluginV2DynamicExt]: could not find any supported formats consistent with input/output data types
../builder/cudnnBuilderGraphNodes.cpp (879) - Misc Error in reportPluginError: 0 (could not find any supported formats consistent with input/output data types)

During debug I found that TensorRT tries only Linear and CHW32 formats, though documentation states that HWC format is supported. This behaviour was found in both 7.2.2 and 7.2.3 versions.


TensorRT Version:
GPU Type:
GeForce RTX 2080
Nvidia Driver Version:
CUDA Version:
CUDNN Version:
Operating System + Version:
Ubuntu 18.04

1 Like

Please refer to below links related custom plugin implementation and sample:

While IPluginV2 and IPluginV2Ext interfaces are still supported for backward compatibility with TensorRT 5.1 and 6.0.x respectively, however, we recommend that you write new plugins or refactor existing ones to target the IPluginV2DynamicExt or IPluginV2IOExt interfaces instead.