TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

node.output().size() == 1 && "TensorRT does not support the indices output in MaxPool!" failure of TensorRT 8.6 when running ONNX model on GPU RTX 3090

Open lhai37 opened this issue 1 year ago • 9 comments

Description

I tried to run the attached ONNX model through trtexec, but it fails with the error: node.output().size() == 1 && "TensorRT does not support the indices output in MaxPool!". This is because MaxPool is being used in the model to produce 2 outputs: the values and indices. Upon checking the officially supported ONNX operators I see that MaxPool layer with indices output is not supported even in TensorRT 10 EA. Is there any plan to support this or workaround for this issue?

Environment

TensorRT Version: 8.6

NVIDIA GPU: RTX 3090

NVIDIA Driver Version: 545

CUDA Version: 11.6

CUDNN Version: 8.8

Operating System: Ubuntu 20.04 64-bit

Python Version (if applicable):

Tensorflow Version (if applicable):

PyTorch Version (if applicable):

Baremetal or Container (if so, version):

Relevant Files

Model link: https://drive.google.com/file/d/1ZvhQiG9NT92CbVK7oAznBR_rAlF5AzzF/view?usp=sharing

Steps To Reproduce

Run trtexec --onnx=model.onnx

Commands or scripts: Run trtexec --onnx=model.onnx

Have you tried the latest release?: N/A

Can this model run on other frameworks? N/A

lhai37 avatar Apr 02 '24 00:04 lhai37

ref
https://docs.nvidia.com/deeplearning/tensorrt/operators/docs/Pooling.html https://docs.nvidia.com/deeplearning/tensorrt/api/python_api/infer/Graph/Layers.html#ipoolinglayer

Computes a per-channel pooling using a sampling window on the input tensor into an output tensor. The supported sampling window shapes are 2-D or 3-D.
If you need 2 outputs of pooling layer, i think for now you’d need to use a plugin.

lix19937 avatar Apr 02 '24 09:04 lix19937

Is there any existing plugin for MaxPool with 2 outputs? I looked through the default plugins that are shipped with TensorRT and didn't see any there, but perhaps someone has already created this elsewhere.

lhai37 avatar Apr 02 '24 16:04 lhai37

You can write a custom plugin by yourself.

lix19937 avatar Apr 02 '24 23:04 lix19937

Is there any existing plugin for MaxPool with 2 outputs? I looked through the default plugins that are shipped with TensorRT and didn't see any there, but perhaps someone has already created this elsewhere.

Were you able to solve the issue? If so, can you please share the plugin? Thanks.

bs1119 avatar Aug 02 '24 19:08 bs1119

You can upload your torch network code fragment about maxpool.

lix19937 avatar Aug 03 '24 03:08 lix19937

I'm having this issue with a pytorch ENET model I exported to ONNX. Has somebody written a custom plugin for the MaxPool layer with indices output? Would love to be able to move past this issue!

kevin-chau avatar Feb 11 '25 19:02 kevin-chau

ref https://docs.nvidia.com/deeplearning/tensorrt/operators/docs/Pooling.html https://docs.nvidia.com/deeplearning/tensorrt/api/python_api/infer/Graph/Layers.html#ipoolinglayer

Computes a per-channel pooling using a sampling window on the input tensor into an output tensor. The supported sampling window shapes are 2-D or 3-D. If you need 2 outputs of pooling layer, i think for now you’d need to use a plugin.

the link provided returning Page Not Found, thanks

ducknificient avatar Apr 04 '25 04:04 ducknificient

I'm having this issue with a pytorch ENET model I exported to ONNX. Has somebody written a custom plugin for the MaxPool layer with indices output? Would love to be able to move past this issue!

Usually maxpool layer will fusion with downstream operator, Of course, writing an implementation using CUDA alone is also very simple.

lix19937 avatar Apr 06 '25 08:04 lix19937

@lix19937 Could you provide some sample code for how to implement MaxPool with CUDA?

kevin-chau avatar Apr 08 '25 03:04 kevin-chau