TensorRT 10.4.0
|
Plugin class for user-implemented layers. More...
#include <NvInferRuntimePlugin.h>
Public Member Functions | |
virtual int32_t | getTensorRTVersion () const noexcept |
Return the API version with which this plugin was built. More... | |
virtual AsciiChar const * | getPluginType () const noexcept=0 |
Return the plugin type. Should match the plugin name returned by the corresponding plugin creator. More... | |
virtual AsciiChar const * | getPluginVersion () const noexcept=0 |
Return the plugin version. Should match the plugin version returned by the corresponding plugin creator. More... | |
virtual int32_t | getNbOutputs () const noexcept=0 |
Get the number of outputs from the layer. More... | |
virtual Dims | getOutputDimensions (int32_t index, Dims const *inputs, int32_t nbInputDims) noexcept=0 |
Get the dimension of an output tensor. More... | |
virtual bool | supportsFormat (DataType type, PluginFormat format) const noexcept=0 |
Check format support. More... | |
virtual void | configureWithFormat (Dims const *inputDims, int32_t nbInputs, Dims const *outputDims, int32_t nbOutputs, DataType type, PluginFormat format, int32_t maxBatchSize) noexcept=0 |
Configure the layer. More... | |
virtual int32_t | initialize () noexcept=0 |
Initialize the layer for execution. This is called when the engine is created. More... | |
virtual void | terminate () noexcept=0 |
Release resources acquired during plugin layer initialization. This is called when the engine is destroyed. More... | |
virtual size_t | getWorkspaceSize (int32_t maxBatchSize) const noexcept=0 |
Find the workspace size required by the layer. More... | |
virtual int32_t | enqueue (int32_t batchSize, void const *const *inputs, void *const *outputs, void *workspace, cudaStream_t stream) noexcept=0 |
Execute the layer. More... | |
virtual size_t | getSerializationSize () const noexcept=0 |
Find the size of the serialization buffer required to store the plugin configuration in a binary file. More... | |
virtual void | serialize (void *buffer) const noexcept=0 |
Serialize the layer. More... | |
virtual void | destroy () noexcept=0 |
Destroy the plugin object. This will be called when the network, builder or engine is destroyed. More... | |
virtual IPluginV2 * | clone () const noexcept=0 |
Clone the plugin object. This copies over internal plugin parameters and returns a new plugin object with these parameters. More... | |
virtual void | setPluginNamespace (AsciiChar const *pluginNamespace) noexcept=0 |
Set the namespace that this plugin object belongs to. Ideally, all plugin objects from the same plugin library must have the same namespace. More... | |
virtual AsciiChar const * | getPluginNamespace () const noexcept=0 |
Return the namespace of the plugin object. More... | |
Plugin class for user-implemented layers.
Plugins are a mechanism for applications to implement custom layers. When combined with IPluginCreator it provides a mechanism to register plugins and look up the Plugin Registry during de-serialization.
|
pure virtualnoexcept |
Clone the plugin object. This copies over internal plugin parameters and returns a new plugin object with these parameters.
The TensorRT runtime calls clone() to clone the plugin when an execution context is created for an engine, after the engine has been created. The runtime does not call initialize() on the cloned plugin, so the cloned plugin must be created in an initialized state.
Usage considerations
Implemented in nvinfer1::IPluginV2DynamicExt, and nvinfer1::IPluginV2Ext.
|
pure virtualnoexcept |
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.
inputDims | The input tensor dimensions. Will be the start address of a Dims array of length nbInputs. |
nbInputs | The number of inputs. Will be a non-negative integer. |
outputDims | The output tensor dimensions. Will be the start address of a Dims array of length nbOutputs. |
nbOutputs | The number of outputs. Will be a positive integer identical to the return value of getNbOutputs(). |
type | The data type selected for the engine. |
format | The format selected for the engine. |
maxBatchSize | The maximum batch size. Will be a positive integer. |
The dimensions passed here do not include the outermost batch size (i.e. for 2-D image networks, they will be 3-dimensional CHW dimensions).
Usage considerations
Implemented in nvinfer1::IPluginV2Ext.
|
pure virtualnoexcept |
Destroy the plugin object. This will be called when the network, builder or engine is destroyed.
Usage considerations
|
pure virtualnoexcept |
Execute the layer.
batchSize | The number of inputs in the batch. |
inputs | The memory for the input tensors. Will be an array of device addresses corresponding to input tensors of length nbInputs, where nbInputs is the second parameter passed to configureWithFormat(). The i-th input tensor will have the dimensions inputDims[i], where inputDims is the first parameter that was passed to configureWithFormat(). |
outputs | The memory for the output tensors. Will be an array of device addresses corresponding to output tensors of length getNbOutputs(). |
workspace | Workspace for execution. Will be the start address of a device buffer whose length will be at least getWorkspaceSize(batchSize). |
stream | The stream in which to execute the kernels. This will be a valid CUDA stream. |
Usage considerations
|
pure virtualnoexcept |
Get the number of outputs from the layer.
This function is called by the implementations of INetworkDefinition and IBuilder. In particular, it is called prior to any call to initialize().
Usage considerations
|
pure virtualnoexcept |
Get the dimension of an output tensor.
index | The index of the output tensor. Will lie in the valid range (between 0 and getNbOutputs()-1 inclusive). |
inputs | The input tensor dimensions. Will be the start address of a Dims array of length nbInputDims. |
nbInputDims | The number of input tensors. Will be a non-negative integer. |
This function is called by the implementations of INetworkDefinition and IBuilder. In particular, it is called prior to any call to initialize().
Usage considerations
|
pure virtualnoexcept |
Return the namespace of the plugin object.
Usage considerations
|
pure virtualnoexcept |
Return the plugin type. Should match the plugin name returned by the corresponding plugin creator.
Usage considerations
|
pure virtualnoexcept |
Return the plugin version. Should match the plugin version returned by the corresponding plugin creator.
Usage considerations
|
pure virtualnoexcept |
Find the size of the serialization buffer required to store the plugin configuration in a binary file.
Usage considerations
|
inlinevirtualnoexcept |
Return the API version with which this plugin was built.
Do not override this method as it is used by the TensorRT library to maintain backwards-compatibility with plugins.
Usage considerations
Reimplemented in nvinfer1::IPluginV2DynamicExt, nvinfer1::IPluginV2Ext, and nvinfer1::IPluginV2IOExt.
|
pure virtualnoexcept |
Find the workspace size required by the layer.
This function is called during engine startup, after initialize(). The workspace size returned must be sufficient for any batch size up to the maximum.
maxBatchSize | The maximum batch size, which will be a positive integer. |
Usage considerations
|
pure virtualnoexcept |
Initialize the layer for execution. This is called when the engine is created.
Usage considerations
|
pure virtualnoexcept |
Serialize the layer.
buffer | A pointer to a host buffer to serialize data. Size of buffer will be at least as large as the value returned by getSerializationSize. |
Usage considerations
|
pure virtualnoexcept |
Set the namespace that this plugin object belongs to. Ideally, all plugin objects from the same plugin library must have the same namespace.
pluginNamespace | The namespace for the plugin object. |
Usage considerations
|
pure virtualnoexcept |
Check format support.
type | DataType requested. |
format | PluginFormat requested. |
This function is called by the implementations of INetworkDefinition, IBuilder, and safe::ICudaEngine/ICudaEngine. In particular, it is called when creating an engine and when deserializing an engine.
Usage considerations
|
pure virtualnoexcept |
Release resources acquired during plugin layer initialization. This is called when the engine is destroyed.
Usage considerations
Copyright © 2024 NVIDIA Corporation
Privacy Policy |
Manage My Privacy |
Do Not Sell or Share My Data |
Terms of Service |
Accessibility |
Corporate Policies |
Product Security |
Contact