How to create more than one custom Op with same Op name? UffParser : Repeated layer name, layers must have distinct names

I Create an custom op realization by TensorRT plugin API. And In the TF model I have more than one custom op with same op name. Parsing uff to nvinfer1::INetworkDefinition is worked right. But use the network to build a nvinfer1::ICudaEngine will be wrong , outputing the message “Repeated layer name xxx, layers must have distinct names”.

I take a look into the uff file , and figure out the custom ops are written the same op name with difference in layer names.But in virtual function createPlugin from IPluginFactory, the param “layerName” passed by the API is actually the op name not the layer name. And there is no API to set the plugin a new layer name or such like this. How should I do to create some custom ops with same op name but different layer names?

Hello

We have fixed this in future TRT release, so the user can have a network with multiple layers with the same plugin operation. Sorry again that we cannot share more information about future release here.
Please pay attention to our announcement for the information

For TRT 4.0 the workaround is to use graphsurgeon to modify the pb file to map certain TF op’s to plugin nodes with different op names and check for those op names in createPlugin function in IPluginFactory.

I have encountered the same issue when using TRT 7.0. Is this already fixed now?

Hi, UFF and Caffe Parser have been deprecated from TensorRT 7 onwards, hence request you to try ONNX parser.

Please check the below link for the same.

Thanks!

Hi,

thanks for your quick reply.

For onnx, the issue is onnx parser API has no method to set plugin factory. So how can I dynamically load custom layer without re-compiling the TRT-related libraries?