IPluginExt

class tensorrt.IPluginExt

Plugin class for user-implemented layers.

Plugins are a mechanism for applications to implement custom layers. Each plugin is owned by the application, and its lifetime must span any use of it by TensorRT.

Variables:tensorrt_versionint The API version with which this plugin was built.
configure_with_format(self: tensorrt.tensorrt.IPluginExt, input_shapes: List[tensorrt.tensorrt.Dims], output_shapes: List[tensorrt.tensorrt.Dims], dtype: tensorrt.tensorrt.DataType, format: nvinfer1::TensorFormat, max_batch_size: int) → None

Configure the layer.

This function is called by the Builder prior to initialize() . It provides an opportunity for the layer to make algorithm choices on the basis of its weights, dimensions, and maximum batch size.

The dimensions passed here do not include the outermost batch size (i.e. for 2D image networks, they will be 3D CHW dimensions).

Parameters:
  • input_shapes – The shapes of the input tensors.
  • output_shapes – The shapes of the output tensors.
  • dtype – The data type selected for the engine.
  • format – The format selected for the engine.
  • max_batch_size – The maximum batch size.
supports_format(self: tensorrt.tensorrt.IPluginExt, dtype: tensorrt.tensorrt.DataType, format: nvinfer1::TensorFormat) → bool

Check format support.

This function is called by the implementations of INetworkDefinition , Builder , and ICudaEngine . In particular, it is called when creating an engine and when deserializing an engine.

Parameters:
  • dtype – Data type requested.
  • format – TensorFormat requested.
Returns:

True if the plugin supports the type-format combination.