ONNX model with the layer adaptive_avg_pool2d is not converting to tensorRT

issue came while converting
[06/08/2021-12:29:44] [I] [TRT] No importer registered for op: adaptive_avg_pool2d. Attempting to import as plugin.
[06/08/2021-12:29:44] [I] [TRT] Searching for plugin: adaptive_avg_pool2d, plugin_version: 1, plugin_namespace:
[06/08/2021-12:29:44] [E] [TRT] 3: getPluginCreator could not find plugin: adaptive_avg_pool2d version: 1
[06/08/2021-12:29:44] [E] [TRT] ModelImporter.cpp:738: While parsing node number 246 [adaptive_avg_pool2d → “input.314”]:
[06/08/2021-12:29:44] [E] [TRT] ModelImporter.cpp:739: — Begin node —
[06/08/2021-12:29:44] [E] [TRT] ModelImporter.cpp:740: input: “998”
input: “1039”
output: “input.314”
op_type: “adaptive_avg_pool2d”

[06/08/2021-12:29:44] [E] [TRT] ModelImporter.cpp:741: — End node —
[06/08/2021-12:29:44] [E] [TRT] ModelImporter.cpp:744: ERROR: builtin_op_importers.cpp:4518 In function importFallbackPluginImporter:
[8] Assertion failed: creator && "Plugin not found, are the plugin name, version, and namespace

Environment

TensorRT Version: 8.0.0.3
GPU Type: gtx 1050
Nvidia Driver Version: 465.27
CUDA Version: 11.3
CUDNN Version: 8
Operating System + Version: ubuntu 20.04
Python Version (if applicable): 3.8
TensorFlow Version (if applicable):
PyTorch Version (if applicable): 1.8
Baremetal or Container (if container which image + tag): baremetal

Relevant Files

onnx model file

Steps To Reproduce

trtexec --onnx=model.onnx --explicitBatch --workspace=16382 --optShapes=input:1x4x512x512 --maxShapes=input:1x4x512x512 --minShapes=input:1x4x512x512 --saveEngine=model.plan

the onnx model here is converted from a pytorch model . while converting , faced issues in the same layer (adaptiveavgpool2d) it is converted by setting operator_export_type as ONNX_ATEN_FALLBACK

you can see layer definitions here

@sivagurunathan.a ,

I tried the same way you mentioned. And found that adaptive_avg_poold2d cannot be executable with native tensorrt via onnx route because of unavailability of custom plugin.

I found another effective way via torch2trt, which has the custom plugin for adaptiveavgpool already.

Complete procedure can be found with perf results in this notebook: nvtorch2trt_dextr/dextr_conversion_torch2trt.ipynb at main · bharat3012/nvtorch2trt_dextr · GitHub

1 Like