TensorRT  6.0.1.5
NvInferPlugin.h File Reference
#include "NvInfer.h"
#include "NvInferPluginUtils.h"

Go to the source code of this file.

Classes

class  nvinfer1::plugin::INvPlugin
 Common interface for the Nvidia created plugins. More...
 

Namespaces

 nvinfer1
 The TensorRT API version 1 namespace.
 

Functions

TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createFasterRCNNPlugin (int featureStride, int preNmsTop, int nmsMaxOut, float iouThreshold, float minBoxSize, float spatialScale, DimsHW pooling, Weights anchorRatios, Weights anchorScales)
 Create a plugin layer that fuses the RPN and ROI pooling using user-defined parameters. More...
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createFasterRCNNPlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDNormalizePlugin (const Weights *scales, bool acrossSpatial, bool channelShared, float eps)
 The Normalize plugin layer normalizes the input to have L2 norm of 1 with scale learnable. More...
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDNormalizePlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDPermutePlugin (Quadruple permuteOrder)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDPermutePlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDPriorBoxPlugin (PriorBoxParameters param)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDPriorBoxPlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDAnchorGeneratorPlugin (GridAnchorParameters *param, int numLayers)
 The Grid Anchor Generator plugin layer generates the prior boxes of designated sizes and aspect ratios across all dimensions (H x W) for all feature maps. GridAnchorParameters defines a set of parameters for creating the GridAnchorGenerator plugin layer. More...
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDAnchorGeneratorPlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDDetectionOutputPlugin (DetectionOutputParameters param)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createSSDDetectionOutputPlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createConcatPlugin (int concatAxis, bool ignoreBatch)
 The Concat plugin layer basically performs the concatention for 4D tensors. Unlike the Concatenation layer in early version of TensorRT, it allows the user to specify the axis along which to concatenate. The axis can be 1 (across channel), 2 (across H), or 3 (across W). More particularly, this Concat plugin layer also implements the "ignoring the batch dimension" switch. If turned on, all the input tensors will be treated as if their batch sizes were 1. More...
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createConcatPlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createPReLUPlugin (float negSlope)
 The PReLu plugin layer performs leaky ReLU for 4D tensors. Give an input value x, the PReLU layer computes the output as x if x > 0 and negative_slope //! x if x <= 0. More...
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createPReLUPlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createYOLOReorgPlugin (int stride)
 The Reorg plugin layer maps the 512x26x26 feature map onto a 2048x13x13 feature map, so that it can be concatenated with the feature maps at 13x13 resolution. More...
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createYOLOReorgPlugin (const void *data, size_t length)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createYOLORegionPlugin (RegionParameters params)
 
TRT_DEPRECATED_API INvPlugin * nvinfer1::plugin::createYOLORegionPlugin (const void *data, size_t length)
 
nvinfer1::IPluginV2createRPNROIPlugin (int featureStride, int preNmsTop, int nmsMaxOut, float iouThreshold, float minBoxSize, float spatialScale, nvinfer1::DimsHW pooling, nvinfer1::Weights anchorRatios, nvinfer1::Weights anchorScales)
 Create a plugin layer that fuses the RPN and ROI pooling using user-defined parameters. Registered plugin type "RPROI_TRT". Registered plugin version "1". More...
 
nvinfer1::IPluginV2createNormalizePlugin (const nvinfer1::Weights *scales, bool acrossSpatial, bool channelShared, float eps)
 The Normalize plugin layer normalizes the input to have L2 norm of 1 with scale learnable. Registered plugin type "Normalize_TRT". Registered plugin version "1". More...
 
nvinfer1::IPluginV2createPriorBoxPlugin (nvinfer1::plugin::PriorBoxParameters param)
 The PriorBox plugin layer generates the prior boxes of designated sizes and aspect ratios across all dimensions (H x W). PriorBoxParameters defines a set of parameters for creating the PriorBox plugin layer. Registered plugin type "PriorBox_TRT". Registered plugin version "1".
 
nvinfer1::IPluginV2createAnchorGeneratorPlugin (nvinfer1::plugin::GridAnchorParameters *param, int numLayers)
 The Grid Anchor Generator plugin layer generates the prior boxes of designated sizes and aspect ratios across all dimensions (H x W) for all feature maps. GridAnchorParameters defines a set of parameters for creating the GridAnchorGenerator plugin layer. Registered plugin type "GridAnchor_TRT". Registered plugin version "1".
 
nvinfer1::IPluginV2createNMSPlugin (nvinfer1::plugin::DetectionOutputParameters param)
 The DetectionOutput plugin layer generates the detection output based on location and confidence predictions by doing non maximum suppression. DetectionOutputParameters defines a set of parameters for creating the DetectionOutput plugin layer. Registered plugin type "NMS_TRT". Registered plugin version "1".
 
TRT_DEPRECATED_API nvinfer1::IPluginV2createLReLUPlugin (float negSlope)
 The LReLu plugin layer performs leaky ReLU for 4D tensors. Give an input value x, the PReLU layer computes the output as x if x > 0 and negative_slope //! x if x <= 0. Registered plugin type "LReLU_TRT". Registered plugin version "1". More...
 
nvinfer1::IPluginV2createReorgPlugin (int stride)
 The Reorg plugin reshapes input of shape CxHxW into a (C*stride*stride)x(H/stride)x(W/stride) shape, used in YOLOv2. It does that by taking 1 x stride x stride slices from tensor and flattening them into (stridexstride) x 1 x 1 shape. Registered plugin type "Reorg_TRT". Registered plugin version "1". More...
 
nvinfer1::IPluginV2createRegionPlugin (nvinfer1::plugin::RegionParameters params)
 The Region plugin layer performs region proposal calculation: generate 5 bounding boxes per cell (for yolo9000, generate 3 bounding boxes per cell). For each box, calculating its probablities of objects detections from 80 pre-defined classifications (yolo9000 has 9416 pre-defined classifications, and these 9416 items are organized as work-tree structure). RegionParameters defines a set of parameters for creating the Region plugin layer. Registered plugin type "Region_TRT". Registered plugin version "1".
 
TRT_DEPRECATED_API nvinfer1::IPluginV2createClipPlugin (const char *layerName, float clipMin, float clipMax)
 The Clip Plugin performs a clip operation on the input tensor. It clips the tensor values to a specified min and max. Any value less than clipMin are set to clipMin. Any values greater than clipMax are set to clipMax. For example, this plugin can be used to perform a Relu6 operation by specifying clipMin=0.0 and clipMax=6.0 Registered plugin type "Clip_TRT". Registered plugin version "1". More...
 
nvinfer1::IPluginV2createBatchedNMSPlugin (nvinfer1::plugin::NMSParameters param)
 The BatchedNMS Plugin performs non_max_suppression on the input boxes, per batch, across all classes. It greedily selects a subset of bounding boxes in descending order of score. Prunes away boxes that have a high intersection-over-union (IOU) overlap with previously selected boxes. Bounding boxes are supplied as [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any diagonal pair of box corners and the coordinates can be provided as normalized (i.e., lying in the interval [0, 1]) or absolute. The plugin expects two inputs. Input0 is expected to be 4-D float boxes tensor of shape [batch_size, num_boxes, q, 4], where q can be either 1 (if shareLocation is true) or num_classes. Input1 is expected to be a 3-D float scores tensor of shape [batch_size, num_boxes, num_classes] representing a single score corresponding to each box. The plugin returns four outputs. num_detections : A [batch_size] int32 tensor indicating the number of valid detections per batch item. Can be less than keepTopK. Only the top num_detections[i] entries in nmsed_boxes[i], nmsed_scores[i] and nmsed_classes[i] are valid. nmsed_boxes : A [batch_size, max_detections, 4] float32 tensor containing the co-ordinates of non-max suppressed boxes. nmsed_scores : A [batch_size, max_detections] float32 tensor containing the scores for the boxes. nmsed_classes : A [batch_size, max_detections] float32 tensor containing the classes for the boxes. More...
 
bool initLibNvInferPlugins (void *logger, const char *libNamespace)
 Initialize and register all the existing TensorRT plugins to the Plugin Registry 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. More...
 

Detailed Description

This is the API for the Nvidia provided TensorRT plugins.

Function Documentation

◆ createBatchedNMSPlugin()

nvinfer1::IPluginV2* createBatchedNMSPlugin ( nvinfer1::plugin::NMSParameters  param)

The BatchedNMS Plugin performs non_max_suppression on the input boxes, per batch, across all classes. It greedily selects a subset of bounding boxes in descending order of score. Prunes away boxes that have a high intersection-over-union (IOU) overlap with previously selected boxes. Bounding boxes are supplied as [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any diagonal pair of box corners and the coordinates can be provided as normalized (i.e., lying in the interval [0, 1]) or absolute. The plugin expects two inputs. Input0 is expected to be 4-D float boxes tensor of shape [batch_size, num_boxes, q, 4], where q can be either 1 (if shareLocation is true) or num_classes. Input1 is expected to be a 3-D float scores tensor of shape [batch_size, num_boxes, num_classes] representing a single score corresponding to each box. The plugin returns four outputs. num_detections : A [batch_size] int32 tensor indicating the number of valid detections per batch item. Can be less than keepTopK. Only the top num_detections[i] entries in nmsed_boxes[i], nmsed_scores[i] and nmsed_classes[i] are valid. nmsed_boxes : A [batch_size, max_detections, 4] float32 tensor containing the co-ordinates of non-max suppressed boxes. nmsed_scores : A [batch_size, max_detections] float32 tensor containing the scores for the boxes. nmsed_classes : A [batch_size, max_detections] float32 tensor containing the classes for the boxes.

Registered plugin type "BatchedNMS_TRT". Registered plugin version "1".

◆ createClipPlugin()

TRT_DEPRECATED_API nvinfer1::IPluginV2* createClipPlugin ( const char *  layerName,
float  clipMin,
float  clipMax 
)

The Clip Plugin performs a clip operation on the input tensor. It clips the tensor values to a specified min and max. Any value less than clipMin are set to clipMin. Any values greater than clipMax are set to clipMax. For example, this plugin can be used to perform a Relu6 operation by specifying clipMin=0.0 and clipMax=6.0 Registered plugin type "Clip_TRT". Registered plugin version "1".

Parameters
layerNameThe name of the TensorRT layer.
clipMinThe minimum value to clip to.
clipMaxThe maximum value to clip to.

◆ createConcatPlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createConcatPlugin ( int  concatAxis,
bool  ignoreBatch 
)

The Concat plugin layer basically performs the concatention for 4D tensors. Unlike the Concatenation layer in early version of TensorRT, it allows the user to specify the axis along which to concatenate. The axis can be 1 (across channel), 2 (across H), or 3 (across W). More particularly, this Concat plugin layer also implements the "ignoring the batch dimension" switch. If turned on, all the input tensors will be treated as if their batch sizes were 1.

Parameters
concatAxisAxis along which to concatenate. Can't be the "N" dimension.
ignoreBatchIf true, all the input tensors will be treated as if their batch sizes were 1.
Deprecated:
. This plugin is superseded by native TensorRT concatenation layer

◆ createFasterRCNNPlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createFasterRCNNPlugin ( int  featureStride,
int  preNmsTop,
int  nmsMaxOut,
float  iouThreshold,
float  minBoxSize,
float  spatialScale,
DimsHW  pooling,
Weights  anchorRatios,
Weights  anchorScales 
)

Create a plugin layer that fuses the RPN and ROI pooling using user-defined parameters.

Parameters
featureStrideFeature stride.
preNmsTopNumber of proposals to keep before applying NMS.
nmsMaxOutNumber of remaining proposals after applying NMS.
iouThresholdIoU threshold.
minBoxSizeMinimum allowed bounding box size before scaling.
spatialScaleSpatial scale between the input image and the last feature map.
poolingSpatial dimensions of pooled ROIs.
anchorRatiosAspect ratios for generating anchor windows.
anchorScalesScales for generating anchor windows.
Returns
Returns a FasterRCNN fused RPN+ROI pooling plugin. Returns nullptr on invalid inputs.
See also
INvPlugin
Deprecated:
. This plugin is superseded by createRPNROIPlugin()

◆ createLReLUPlugin()

TRT_DEPRECATED_API nvinfer1::IPluginV2* createLReLUPlugin ( float  negSlope)

The LReLu plugin layer performs leaky ReLU for 4D tensors. Give an input value x, the PReLU layer computes the output as x if x > 0 and negative_slope //! x if x <= 0. Registered plugin type "LReLU_TRT". Registered plugin version "1".

Parameters
negSlopeNegative_slope value.

◆ createNormalizePlugin()

nvinfer1::IPluginV2* createNormalizePlugin ( const nvinfer1::Weights scales,
bool  acrossSpatial,
bool  channelShared,
float  eps 
)

The Normalize plugin layer normalizes the input to have L2 norm of 1 with scale learnable. Registered plugin type "Normalize_TRT". Registered plugin version "1".

Parameters
scalesScale weights that are applied to the output tensor.
acrossSpatialWhether to compute the norm over adjacent channels (acrossSpatial is true) or nearby spatial locations (within channel in which case acrossSpatial is false).
channelSharedWhether the scale weight(s) is shared across channels.
epsEpsilon for not diviiding by zero.

◆ createPReLUPlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createPReLUPlugin ( float  negSlope)

The PReLu plugin layer performs leaky ReLU for 4D tensors. Give an input value x, the PReLU layer computes the output as x if x > 0 and negative_slope //! x if x <= 0.

Parameters
negSlopeNegative_slope value.
Deprecated:
. This plugin is superseded by createLReLUPlugin()

◆ createReorgPlugin()

nvinfer1::IPluginV2* createReorgPlugin ( int  stride)

The Reorg plugin reshapes input of shape CxHxW into a (C*stride*stride)x(H/stride)x(W/stride) shape, used in YOLOv2. It does that by taking 1 x stride x stride slices from tensor and flattening them into (stridexstride) x 1 x 1 shape. Registered plugin type "Reorg_TRT". Registered plugin version "1".

Parameters
strideStrides in H and W, it should divide both H and W. Also stride * stride should be less than or equal to C.

◆ createRPNROIPlugin()

nvinfer1::IPluginV2* createRPNROIPlugin ( int  featureStride,
int  preNmsTop,
int  nmsMaxOut,
float  iouThreshold,
float  minBoxSize,
float  spatialScale,
nvinfer1::DimsHW  pooling,
nvinfer1::Weights  anchorRatios,
nvinfer1::Weights  anchorScales 
)

Create a plugin layer that fuses the RPN and ROI pooling using user-defined parameters. Registered plugin type "RPROI_TRT". Registered plugin version "1".

Parameters
featureStrideFeature stride.
preNmsTopNumber of proposals to keep before applying NMS.
nmsMaxOutNumber of remaining proposals after applying NMS.
iouThresholdIoU threshold.
minBoxSizeMinimum allowed bounding box size before scaling.
spatialScaleSpatial scale between the input image and the last feature map.
poolingSpatial dimensions of pooled ROIs.
anchorRatiosAspect ratios for generating anchor windows.
anchorScalesScales for generating anchor windows.
Returns
Returns a FasterRCNN fused RPN+ROI pooling plugin. Returns nullptr on invalid inputs.

◆ createSSDAnchorGeneratorPlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createSSDAnchorGeneratorPlugin ( GridAnchorParameters param,
int  numLayers 
)

The Grid Anchor Generator plugin layer generates the prior boxes of designated sizes and aspect ratios across all dimensions (H x W) for all feature maps. GridAnchorParameters defines a set of parameters for creating the GridAnchorGenerator plugin layer.

Deprecated:
. This plugin is superseded by createAnchorGeneratorPlugin()

◆ createSSDDetectionOutputPlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createSSDDetectionOutputPlugin ( DetectionOutputParameters  param)
Parameters
paramSet of parameters for creating the DetectionOutput plugin layer.
Deprecated:
. This plugin is superseded by createNMSPlugin()

◆ createSSDNormalizePlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createSSDNormalizePlugin ( const Weights scales,
bool  acrossSpatial,
bool  channelShared,
float  eps 
)

The Normalize plugin layer normalizes the input to have L2 norm of 1 with scale learnable.

Parameters
scalesScale weights that are applied to the output tensor.
acrossSpatialWhether to compute the norm over adjacent channels (acrossSpatial is true) or nearby spatial locations (within channel in which case acrossSpatial is false).
channelSharedWhether the scale weight(s) is shared across channels.
epsEpsilon for not diviiding by zero.
Deprecated:
. This plugin is superseded by createNormalizePlugin()

◆ createSSDPermutePlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createSSDPermutePlugin ( Quadruple  permuteOrder)
Parameters
permuteOrderThe new orders that are used to permute the data.
Deprecated:
. Please use the TensorRT Shuffle layer for Permute operation

◆ createSSDPriorBoxPlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createSSDPriorBoxPlugin ( PriorBoxParameters  param)
Parameters
paramSet of parameters for creating the PriorBox plugin layer.
Deprecated:
. This plugin is superseded by createPriorBoxPlugin()

◆ createYOLOReorgPlugin()

TRT_DEPRECATED_API INvPlugin* nvinfer1::plugin::createYOLOReorgPlugin ( int  stride)

The Reorg plugin layer maps the 512x26x26 feature map onto a 2048x13x13 feature map, so that it can be concatenated with the feature maps at 13x13 resolution.

Parameters
strideStrides in H and W.
Deprecated:
. This plugin is superseded by createReorgPlugin()

◆ initLibNvInferPlugins()

bool initLibNvInferPlugins ( void *  logger,
const char *  libNamespace 
)

Initialize and register all the existing TensorRT plugins to the Plugin Registry 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
loggerLogger object to print plugin registration information
libNamespaceNamespace used to register all the plugins in this library