TensorRT add_plugin() in Python

Hi,

I am trying to create a global pooling plugin layer in python by add_plugin(), but honestly the python tutorial about that api is too short, can I ask more tutorial about how to add plugin layer in python or if there is any example online?

I’m also trying to create a TensorRT Plugin layer, implemented in Python.

class IdentityPlugin(trt.infer.Plugin):
    def __init__(self):
        super(IdentityPlugin, self).__init__()
    ....

class TestPluginFactory(trt.infer.PluginFactory):
    pass

....

id_plugin = IdentityPlugin()

id_layer = network.add_plugin(conv1.get_output(0), 1, id_plugin)

This is failing because add_plugin expects “nvinfer1::ITensor *const *'” as it’s first argument, but conv1.get_output() returns a “ITensor *”.

Is it at all possible to create plugins and custom layers directly in Python? If yes, how do I make the code above work?