Any plans for a TensorRT plugin that can directly use a (dynamic) shape tensor?


(Note: This is question about a feature/plans for a feature. I have no issue implementing a custom plugin with dynamic shapes)

I have a custom plugin layer, “MyPlugin” (Inherited from IPluginV2DynamicExt). I want the output of MyPlugin to be the same shape as some tensor, “X”, in my network (the shape of X can be dynamic). However, the output of MyPlugin does not directly depend on X. Regardless, I pass tensor X as an input to MyPlugin so that I can use it’s shape in MyPlugin::getOutputDimensions(). This is okay, but makes my plugin more confusing to use. Are there any plans for a feature that would allow me to directly just use the shape of X (similar to how IResize layer works)?


TensorRT Version:

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.


Hi, thank you for the response. However, I don’t think my question was clear. I have implemented my plugin with IPluginV2DynamicExt already.

I was wondering if, in the future, there would be support for a plugin that can use the output of an IShapeLayer to determine the output dimensions of the plugin. I.e. the way IResizeLayer and IShuffleLayer work Developer Guide :: NVIDIA Deep Learning TensorRT Documentation. In other words, I want to access the values of a shape tensor when determining the output dimensions of my plugin. The PluginV2DynamicExt interface only allows me to access the shape of my inputs, but the shape that I want isn’t necessarily the shape of one of my inputs.

I want one of the inputs to my plugin to be “shape of X”, and I want the output dimensions of my plugin to depend on this shape.

My workaround right now is to just pass in X to my plugin, but this doesn’t convey the meaning of my plugin very well.

Hi @adam.alcolado ,
We have noted your suggestion and passed it to the Engg Team,
Please stay tuned to the TRT Release Notes for latest updates.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.