TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
nvinfer1::plugin::BasePlugin Class Referenceabstract
Inheritance diagram for nvinfer1::plugin::BasePlugin:
Collaboration diagram for nvinfer1::plugin::BasePlugin:

Public Member Functions

virtual int32_t getTensorRTVersion () const
 Return the API version with which this plugin was built. More...
 
virtual const char * getPluginType () const =0
 Return the plugin type. More...
 
virtual const char * getPluginVersion () const =0
 Return the plugin version. More...
 
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 bool supportsFormat (DataType type, PluginFormat format) const =0
 Check format support. More...
 
virtual void configureWithFormat (const Dims *inputDims, int32_t nbInputs, const Dims *outputDims, int32_t nbOutputs, DataType type, PluginFormat format, 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 () const =0
 Find the size of the serialization buffer required. More...
 
virtual void serialize (void *buffer) const =0
 Serialize the layer. More...
 
virtual void destroy ()=0
 Destroy the plugin object. More...
 
virtual IPluginV2clone () const =0
 Clone the plugin object. More...
 

Protected Member Functions

void setPluginNamespace (const char *libNamespace) override
 Set the namespace that this plugin object belongs to. More...
 
const char * getPluginNamespace () const override
 Return the namespace of the plugin object. More...
 

Protected Attributes

std::string mNamespace
 

Member Function Documentation

◆ setPluginNamespace()

void nvinfer1::plugin::BasePlugin::setPluginNamespace ( const char *  pluginNamespace)
inlineoverrideprotectedvirtual

Set the namespace that this plugin object belongs to.

Ideally, all plugin objects from the same plugin library should have the same namespace.

Implements nvinfer1::IPluginV2.

◆ getPluginNamespace()

const char* nvinfer1::plugin::BasePlugin::getPluginNamespace ( ) const
inlineoverrideprotectedvirtual

Return the namespace of the plugin object.

Implements nvinfer1::IPluginV2.

◆ getTensorRTVersion()

virtual int32_t nvinfer1::IPluginV2::getTensorRTVersion ( ) const
inlinevirtualinherited

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.

Reimplemented in nvinfer1::IPluginV2Ext, and nvinfer1::IPluginV2DynamicExt.

◆ getPluginType()

◆ getPluginVersion()

◆ getNbOutputs()

◆ getOutputDimensions()

virtual Dims nvinfer1::IPluginV2::getOutputDimensions ( int32_t  index,
const Dims inputs,
int32_t  nbInputDims 
)
pure virtualinherited

Get the dimension of an output tensor.

Parameters
indexThe index of the output tensor.
inputsThe input tensors.
nbInputDimsThe 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().

◆ supportsFormat()

virtual bool nvinfer1::IPluginV2::supportsFormat ( DataType  type,
PluginFormat  format 
) const
pure virtualinherited

Check format support.

Parameters
typeDataType requested.
formatPluginFormat requested.
Returns
true if the plugin supports the type-format combination.

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.

Warning
for the format field, the values PluginFormat::kCHW4, PluginFormat::kCHW16, and PluginFormat::kCHW32 will not be passed in, this is to keep backward compatibility with TensorRT 5.x series. Use PluginV2IOExt or PluginV2DynamicExt for other PluginFormats.
DataType:kBOOL not supported.

Implemented in nvinfer1::plugin::FlattenConcat, nvinfer1::plugin::ProposalPlugin, nvinfer1::plugin::CropAndResizePlugin, nvinfer1::plugin::SpecialSlice, nvinfer1::plugin::ProposalLayer, nvinfer1::plugin::BatchTilePlugin, nvinfer1::plugin::CoordConvACPlugin, nvinfer1::plugin::GenerateDetection, nvinfer1::plugin::MultilevelCropAndResize, nvinfer1::plugin::PyramidROIAlign, nvinfer1::plugin::DetectionLayer, nvinfer1::plugin::MultilevelProposeROI, nvinfer1::plugin::ResizeNearest, nvinfer1::plugin::LReLU, nvinfer1::plugin::Normalize, nvinfer1::plugin::DetectionOutput, nvinfer1::plugin::RPROIPlugin, nvinfer1::plugin::PriorBox, nvinfer1::plugin::Region, nvinfer1::plugin::Reorg, nvinfer1::plugin::GridAnchorGenerator, and nvinfer1::plugin::BatchedNMSPlugin.

◆ configureWithFormat()

virtual void nvinfer1::IPluginV2::configureWithFormat ( const Dims inputDims,
int32_t  nbInputs,
const Dims outputDims,
int32_t  nbOutputs,
DataType  type,
PluginFormat  format,
int32_t  maxBatchSize 
)
pure virtualinherited

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.

Parameters
inputDimsThe input tensor dimensions.
nbInputsThe number of inputs.
outputDimsThe output tensor dimensions.
nbOutputsThe number of outputs.
typeThe data type selected for the engine.
formatThe format selected for the engine.
maxBatchSizeThe 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).

Warning
for the format field, the values PluginFormat::kCHW4, PluginFormat::kCHW16, and PluginFormat::kCHW32 will not be passed in, this is to keep backward compatibility with TensorRT 5.x series. Use PluginV2IOExt or PluginV2DynamicExt for other PluginFormats.
DataType:kBOOL not supported.

Implemented in nvinfer1::IPluginV2Ext.

◆ initialize()

◆ terminate()

◆ getWorkspaceSize()

virtual size_t nvinfer1::IPluginV2::getWorkspaceSize ( int32_t  maxBatchSize) const
pure virtualinherited

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.

Returns
The workspace size.

◆ enqueue()

virtual int32_t nvinfer1::IPluginV2::enqueue ( int32_t  batchSize,
const void *const *  inputs,
void **  outputs,
void *  workspace,
cudaStream_t  stream 
)
pure virtualinherited

Execute the layer.

Parameters
batchSizeThe number of inputs in the batch.
inputsThe memory for the input tensors.
outputsThe memory for the output tensors.
workspaceWorkspace for execution.
streamThe stream in which to execute the kernels.
Returns
0 for success, else non-zero (which will cause engine termination).

◆ getSerializationSize()

◆ serialize()

◆ destroy()

◆ clone()

Member Data Documentation

◆ mNamespace

std::string nvinfer1::plugin::BasePlugin::mNamespace
protected

The documentation for this class was generated from the following file: