IPluginRegistry

class tensorrt.IPluginRegistry

Registers plugin creators.

Variables
  • plugin_creator_list – All the registered plugin creators.

  • error_recorderIErrorRecorder Application-implemented error reporting interface for TensorRT objects.

  • parent_search_enabled – bool variable indicating whether parent search is enabled. Default is True.

acquire_plugin_resource(self: tensorrt.tensorrt.IPluginRegistry, key: str, resource: tensorrt.tensorrt.IPluginResource) tensorrt.tensorrt.IPluginResource

Get a handle to a plugin resource registered against the provided key.

Arg

key: Key for identifying the resource.

Arg

resource: A plugin resource object. The object will only need to be valid until this method returns, as only a clone of this object will be registered by TRT. Cannot be null.

deregister_creator(*args, **kwargs)

Overloaded function.

  1. deregister_creator(self: tensorrt.tensorrt.IPluginRegistry, creator: tensorrt.tensorrt.IPluginCreator) -> bool

    Deregister a previously registered plugin creator inheriting from IPluginCreator.

    Since there may be a desire to limit the number of plugins, this function provides a mechanism for removing plugin creators registered in TensorRT. The plugin creator that is specified by creator is removed from TensorRT and no longer tracked.

    arg creator

    The IPluginCreator instance.

    returns

    True if the plugin creator was deregistered, False if it was not found in the registry or otherwise could not be deregistered.

  2. deregister_creator(self: tensorrt.tensorrt.IPluginRegistry, creator: tensorrt.tensorrt.IPluginCreatorInterface) -> bool

    Deregister a previously registered plugin creator.

    Since there may be a desire to limit the number of plugins, this function provides a mechanism for removing plugin creators registered in TensorRT. The plugin creator that is specified by creator is removed from TensorRT and no longer tracked.

    arg creator

    The plugin creator instance.

    returns

    True if the plugin creator was deregistered, False if it was not found in the registry or otherwise could not be deregistered.

deregister_library(self: tensorrt.tensorrt.IPluginRegistry, handle: capsule) None

Deregister plugins associated with a library. Any resources acquired when the library was loaded will be released.

Arg

handle: the plugin library handle to deregister.

get_creator(self: tensorrt.tensorrt.IPluginRegistry, type: str, version: str, plugin_namespace: str = '') object

Return plugin creator based on type, version and namespace

Parameters
  • type – The type of the plugin.

  • version – The version of the plugin.

  • plugin_namespace – The namespace of the plugin.

Returns

An IPluginCreator .

get_plugin_creator(self: tensorrt.tensorrt.IPluginRegistry, type: str, version: str, plugin_namespace: str = '') tensorrt.tensorrt.IPluginCreator

Return plugin creator based on type, version and namespace

Warning

Returns None if a plugin creator with matching name, version, and namespace is found, but is not a descendent of IPluginCreator

Parameters
  • type – The type of the plugin.

  • version – The version of the plugin.

  • plugin_namespace – The namespace of the plugin.

Returns

An IPluginCreator .

load_library(self: tensorrt.tensorrt.IPluginRegistry, plugin_path: str) capsule

Load and register a shared library of plugins.

Arg

plugin_path: the plugin library path.

Returns

The loaded plugin library handle. The call will fail and return None if any of the plugins are already registered.

register_creator(*args, **kwargs)

Overloaded function.

  1. register_creator(self: tensorrt.tensorrt.IPluginRegistry, creator: tensorrt.tensorrt.IPluginCreator, plugin_namespace: str = ‘’) -> bool

    Register a plugin creator implementing IPluginCreator.

    arg creator

    The IPluginCreator instance.

    arg plugin_namespace

    The namespace of the plugin creator.

    returns

    False if any plugin creator with the same name, version and namespace is already registered.

  2. register_creator(self: tensorrt.tensorrt.IPluginRegistry, creator: tensorrt.tensorrt.IPluginCreatorInterface, plugin_namespace: str = ‘’) -> bool

    Register a plugin creator.

    arg creator

    The plugin creator instance.

    arg plugin_namespace

    The namespace of the plugin creator.

    returns

    False if any plugin creator with the same name, version and namespace is already registered..

release_plugin_resource(self: tensorrt.tensorrt.IPluginRegistry, key: str) int

Decrement reference count for the resource with this key. If reference count goes to zero after decrement, release() will be invoked on the resource, and the key will be deregistered.

Arg

key: Key that was used to register the resource.

class tensorrt.IPluginResource

Interface for plugins to define custom resources that could be shared through the plugin registry

clone(self: tensorrt.tensorrt.IPluginResource) tensorrt.tensorrt.IPluginResource

Resource initialization (if any) may be skipped for non-cloned objects since only clones will be registered by TensorRT.

release(self: tensorrt.tensorrt.IPluginResource) None

This will only be called for IPluginResource objects that were produced from IPluginResource::clone().

The IPluginResource object on which release() is called must still be in a clone-able state after release() returns.

tensorrt.get_plugin_registry() tensorrt.tensorrt.IPluginRegistry

Return the plugin registry for standard runtime

tensorrt.init_libnvinfer_plugins(logger: capsule, namespace: str) bool

Initialize and register all the existing TensorRT plugins to the IPluginRegistry with an optional namespace. The plugin library author should ensure that this function name is unique to the library. This function should be called once before accessing the Plugin Registry.

Parameters
  • logger – Logger to print plugin registration information.

  • namespace – Namespace used to register all the plugins in this library.

tensorrt.get_builder_plugin_registry(arg0: tensorrt.tensort.EngineCapability) tensorrt.tensorrt.IPluginRegistry

Return the plugin registry used for building engines for the specified runtime