Plugin class for user-implemented layers. More...
Public Member Functions | |
virtual int32_t | getNbOutputs () const =0 |
Get the number of outputs from the layer. More... | |
virtual Dims | getOutputDimensions (int32_t index, const Dims *inputs, int32_t nbInputDims)=0 |
Get the dimension of an output tensor. More... | |
virtual void | configure (const Dims *inputDims, int32_t nbInputs, const Dims *outputDims, int32_t nbOutputs, int32_t maxBatchSize)=0 |
Configure the layer. More... | |
virtual int32_t | initialize ()=0 |
Initialize the layer for execution. More... | |
virtual void | terminate ()=0 |
Release resources acquired during plugin layer initialization. More... | |
virtual size_t | getWorkspaceSize (int32_t maxBatchSize) const =0 |
Find the workspace size required by the layer. More... | |
virtual int32_t | enqueue (int32_t batchSize, const void *const *inputs, void **outputs, void *workspace, cudaStream_t stream)=0 |
Execute the layer. More... | |
virtual size_t | getSerializationSize ()=0 |
Find the size of the serialization buffer required. More... | |
virtual void | serialize (void *buffer)=0 |
Serialize the layer. More... | |
virtual | ~IPlugin () |
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
|
inlinevirtual |
|
pure virtual |
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().
Implemented in FCPlugin, and nmtSample::DebugUtil::DumpTensorPlugin.
|
pure virtual |
Get the dimension of an output tensor.
index | The index of the output tensor. |
inputs | The input tensors. |
nbInputDims | The number of input tensors. |
This function is called by the implementations of INetworkDefinition and IBuilder. In particular, it is called prior to any call to initialize().
|
pure virtual |
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 type is assumed to be FP32 and format NCHW.
inputDims | The input tensor dimensions. |
nbInputs | The number of inputs. |
outputDims | The output tensor dimensions. |
nbOutputs | The number of outputs. |
maxBatchSize | The maximum batch size. |
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).
This method is not called for PluginExt classes, configureWithFormat is called instead.
Implemented in nvinfer1::IPluginExt.
|
pure virtual |
Initialize the layer for execution.
This is called when the engine is created.
Implemented in FCPlugin, and nmtSample::DebugUtil::DumpTensorPlugin.
|
pure virtual |
Release resources acquired during plugin layer initialization.
This is called when the engine is destroyed.
Implemented in FCPlugin, and nmtSample::DebugUtil::DumpTensorPlugin.
|
pure virtual |
Find the workspace size required by the layer.
This function is called during engine startup, after initialize(). The workspace size returned should be sufficient for any batch size up to the maximum.
|
pure virtual |
Execute the layer.
batchSize | The number of inputs in the batch. |
inputs | The memory for the input tensors. |
outputs | The memory for the output tensors. |
workspace | Workspace for execution. |
stream | The stream in which to execute the kernels. |
|
pure virtual |
Find the size of the serialization buffer required.
Implemented in FCPlugin, and nmtSample::DebugUtil::DumpTensorPlugin.
|
pure virtual |
Serialize the layer.
buffer | A pointer to a buffer of size at least that returned by getSerializationSize(). |
Implemented in FCPlugin, and nmtSample::DebugUtil::DumpTensorPlugin.