I want to create a custom plugin to do adaptive pooling with dynamic shape support. And it would be cool if I can feed a shape tensor as the pooling output size. like below:
It seems that getOutputDimensions() can only get the “shape” of the shape tensor, not the value. What should I do to implement this?
Environment
TensorRT Version : 7.0 GPU Type : 2080ti Nvidia Driver Version : 440 CUDA Version : 10.0 CUDNN Version : Operating System + Version : ubuntu18.04 Python Version (if applicable) : 3.7 TensorFlow Version (if applicable) : PyTorch Version (if applicable) : 1.4 Baremetal or Container (if container which image + tag) :
add_shape() give me a tensor of shape (4,) with value (n,c,h,w), I want to use the value (n,c,h,w) (the value might pass through other layer like elementwise or slice, generate a new int32 tensor) to decide the output of my custom layer, but I can only get (4,) in getOutputDimensions. How did IResizeLayer and IShuffleLayer implement this? Can I do the same with my custom layer?
by the way, here is my plugin code, for now I use another big tensor as the shape provider. Hope there is a better way :