TensorRT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
nvinfer1 Namespace Reference

The TensorRT API version 1 namespace. More...

Classes

class  Dims
 Structure to define the dimensions of a tensor. More...
 
class  Dims2
 Descriptor for two-dimensional data. More...
 
class  DimsHW
 Descriptor for two-dimensional spatial data. More...
 
class  Dims3
 Descriptor for three-dimensional data. More...
 
class  DimsCHW
 Descriptor for data with one channel dimension and two spatial dimensions. More...
 
class  Dims4
 Descriptor for four-dimensional data. More...
 
class  DimsNCHW
 Descriptor for data with one index dimension, one channel dimension and two spatial dimensions. More...
 
class  Weights
 An array of weights used as a layer parameter. More...
 
class  IHostMemory
 Class to handle library allocated memory that is accessible to the user. More...
 
class  ITensor
 A tensor in a network definition. More...
 
class  ILayer
 Base class for all layer classes in a network definition. More...
 
class  IConvolutionLayer
 A convolution layer in a network definition. More...
 
class  IFullyConnectedLayer
 A fully connected layer in a network definition. This layer expects an input tensor of three or more non-batch dimensions. The input is automatically reshaped into an MxV tensor X, where V is a product of the last three dimensions and M is a product of the remaining dimensions (where the product over 0 dimensions is defined as 1). For example: More...
 
class  IActivationLayer
 An Activation layer in a network definition. More...
 
class  IPoolingLayer
 A Pooling layer in a network definition. More...
 
class  ILRNLayer
 A LRN layer in a network definition. More...
 
class  IScaleLayer
 A Scale layer in a network definition. More...
 
class  ISoftMaxLayer
 A Softmax layer in a network definition. More...
 
class  IConcatenationLayer
 A concatenation layer in a network definition. More...
 
class  IDeconvolutionLayer
 A deconvolution layer in a network definition. More...
 
class  IElementWiseLayer
 A elementwise layer in a network definition. More...
 
class  IGatherLayer
 
class  IRNNLayer
 A RNN layer in a network definition. More...
 
class  IRNNv2Layer
 An RNN layer in a network definition, version 2. More...
 
class  IOutputDimensionsFormula
 Application-implemented interface to compute layer output sizes. More...
 
class  IPlugin
 Plugin class for user-implemented layers. More...
 
class  IPluginExt
 Plugin class for user-implemented layers. More...
 
class  IPluginLayer
 Layer type for plugins. More...
 
class  IUnaryLayer
 Layer that represents an unary operation. More...
 
class  IReduceLayer
 Layer that represents a reduction operator. More...
 
class  IPaddingLayer
 Layer that represents a padding operation. More...
 
struct  Permutation
 
class  IShuffleLayer
 Layer type for shuffling data. More...
 
class  ITopKLayer
 Layer that represents a TopK reduction. More...
 
class  IMatrixMultiplyLayer
 Layer that represents a Matrix Multiplication. More...
 
class  IRaggedSoftMaxLayer
 A RaggedSoftmax layer in a network definition. More...
 
class  IConstantLayer
 Layer that represents a constant value. More...
 
class  INetworkDefinition
 A network definition for input to the builder. More...
 
class  IProfiler
 Application-implemented interface for profiling. More...
 
class  IExecutionContext
 Context for executing inference using an engine. More...
 
class  ICudaEngine
 An engine for executing inference on a built network. More...
 
class  IInt8Calibrator
 Application-implemented interface for calibration. More...
 
class  IInt8EntropyCalibrator
 
class  IInt8LegacyCalibrator
 
class  IGpuAllocator
 Application-implemented class for controlling allocation on the GPU. More...
 
class  IBuilder
 Builds an engine from a network definition. More...
 
class  IPluginFactory
 Plugin factory for deserialization. More...
 
class  IRuntime
 Allows a serialized engine to be deserialized. More...
 
class  ILogger
 Application-implemented logging interface for the builder, engine and runtime. More...
 

Enumerations

enum  DataType : int { DataType::kFLOAT = 0, DataType::kHALF = 1, DataType::kINT8 = 2, DataType::kINT32 = 3 }
 The type of weights and tensors. More...
 
enum  DimensionType : int { DimensionType::kSPATIAL = 0, DimensionType::kCHANNEL = 1, DimensionType::kINDEX = 2, DimensionType::kSEQUENCE = 3 }
 The type of data encoded across this dimension. More...
 
enum  LayerType : int {
  LayerType::kCONVOLUTION = 0, LayerType::kFULLY_CONNECTED = 1, LayerType::kACTIVATION = 2, LayerType::kPOOLING = 3,
  LayerType::kLRN = 4, LayerType::kSCALE = 5, LayerType::kSOFTMAX = 6, LayerType::kDECONVOLUTION = 7,
  LayerType::kCONCATENATION = 8, LayerType::kELEMENTWISE = 9, LayerType::kPLUGIN = 10, LayerType::kRNN = 11,
  LayerType::kUNARY = 12, LayerType::kPADDING = 13, LayerType::kSHUFFLE = 14, LayerType::kREDUCE = 15,
  LayerType::kTOPK = 16, LayerType::kGATHER = 17, LayerType::kMATRIX_MULTIPLY = 18, LayerType::kRAGGED_SOFTMAX = 19,
  LayerType::kCONSTANT = 20, LayerType::kRNN_V2 = 21
}
 The type values of layer classes. More...
 
enum  TensorLocation : int { TensorLocation::kDEVICE = 0, TensorLocation::kHOST = 1 }
 The location for tensor data storage, device or host. More...
 
enum  ActivationType : int { ActivationType::kRELU = 0, ActivationType::kSIGMOID = 1, ActivationType::kTANH = 2 }
 Enumerates the types of activation to perform in an activation layer. More...
 
enum  PoolingType : int { kMAX = 0, kAVERAGE = 1, kMAX_AVERAGE_BLEND = 2 }
 The type of pooling to perform in a pooling layer.
 
enum  ScaleMode : int { ScaleMode::kUNIFORM = 0, ScaleMode::kCHANNEL = 1, ScaleMode::kELEMENTWISE = 2 }
 Controls how scale is applied in a Scale layer. More...
 
enum  ElementWiseOperation : int {
  ElementWiseOperation::kSUM = 0, ElementWiseOperation::kPROD = 1, ElementWiseOperation::kMAX = 2, ElementWiseOperation::kMIN = 3,
  ElementWiseOperation::kSUB = 4, ElementWiseOperation::kDIV = 5, ElementWiseOperation::kPOW = 6
}
 Enumerates the binary operations that may be performed by an ElementWise layer. More...
 
enum  RNNOperation : int { RNNOperation::kRELU = 0, RNNOperation::kTANH = 1, RNNOperation::kLSTM = 2, RNNOperation::kGRU = 3 }
 Enumerates the RNN operations that may be performed by an RNN layer. More...
 
enum  RNNDirection : int { RNNDirection::kUNIDIRECTION = 0, RNNDirection::kBIDIRECTION = 1 }
 Enumerates the RNN direction that may be performed by an RNN layer. More...
 
enum  RNNInputMode : int { RNNInputMode::kLINEAR = 0, RNNInputMode::kSKIP = 1 }
 Enumerates the RNN input modes that may occur with an RNN layer. More...
 
enum  RNNGateType : int {
  RNNGateType::kINPUT = 0, RNNGateType::kOUTPUT = 1, RNNGateType::kFORGET = 2, RNNGateType::kUPDATE = 3,
  RNNGateType::kRESET = 4, RNNGateType::kCELL = 5, RNNGateType::kHIDDEN = 6
}
 Identifies an individual gate within an RNN cell. More...
 
enum  PluginFormat : uint8_t { PluginFormat::kNCHW = 0, PluginFormat::kNC2HW2 = 1, PluginFormat::kNHWC8 = 2 }
 
enum  UnaryOperation : int {
  UnaryOperation::kEXP = 0, UnaryOperation::kLOG = 1, UnaryOperation::kSQRT = 2, UnaryOperation::kRECIP = 3,
  UnaryOperation::kABS = 4, UnaryOperation::kNEG = 5
}
 Enumerates the unary operations that may be performed by a Unary layer. More...
 
enum  ReduceOperation : int {
  kSUM = 0, kPROD = 1, kMAX = 2, kMIN = 3,
  kAVG = 4
}
 Enumerates the reduce operations that may be performed by a Reduce layer.
 
enum  TopKOperation : int { TopKOperation::kMAX = 0, TopKOperation::kMIN = 1 }
 Enumerates the operations that may be performed by a TopK layer. More...
 
enum  CalibrationAlgoType : int { kLEGACY_CALIBRATION = 0, kENTROPY_CALIBRATION = 1 }
 Version of calibration algorithm to use. More...
 
enum  PluginType : int {
  PluginType::kFASTERRCNN = 0, PluginType::kNORMALIZE = 1, PluginType::kPERMUTE = 2, PluginType::kPRIORBOX = 3,
  PluginType::kSSDDETECTIONOUTPUT = 4, PluginType::kCONCAT = 5, PluginType::kPRELU = 6, PluginType::kYOLOREORG = 7,
  PluginType::kYOLOREGION = 8, PluginType::kANCHORGENERATOR = 9
}
 The type values for the various plugins. More...
 

Functions

template<typename T >
int EnumMax ()
 Maximum number of elements in an enumeration type.
 
template<>
int EnumMax< DataType > ()
 Maximum number of elements in DataType enum. More...
 
template<>
int EnumMax< DimensionType > ()
 Maximum number of elements in DimensionType enum. More...
 
template<>
int EnumMax< LayerType > ()
 Maximum number of elements in LayerType enum. More...
 
template<>
int EnumMax< TensorLocation > ()
 Maximum number of elements in TensorLocation enum. More...
 
template<>
int EnumMax< ActivationType > ()
 Maximum number of elements in ActivationType enum. More...
 
template<>
int EnumMax< PoolingType > ()
 Maximum number of elements in PoolingType enum. More...
 
template<>
int EnumMax< ScaleMode > ()
 Maximum number of elements in ScaleMode enum. More...
 
template<>
int EnumMax< ElementWiseOperation > ()
 Maximum number of elements in ElementWiseOperation enum. More...
 
template<>
int EnumMax< RNNOperation > ()
 Maximum number of elements in RNNOperation enum. More...
 
template<>
int EnumMax< RNNDirection > ()
 Maximum number of elements in RNNDirection enum. More...
 
template<>
int EnumMax< RNNInputMode > ()
 Maximum number of elements in RNNInputMode enum. More...
 
template<>
int EnumMax< RNNGateType > ()
 Maximum number of elements in RNNGateType enum. More...
 
template<>
int EnumMax< PluginFormat > ()
 Maximum number of elements in PluginFormat enum. More...
 
template<>
int EnumMax< UnaryOperation > ()
 Maximum number of elements in UnaryOperation enum. More...
 
template<>
int EnumMax< ReduceOperation > ()
 Maximum number of elements in ReduceOperation enum. More...
 
template<>
int EnumMax< TopKOperation > ()
 Maximum number of elements in TopKOperation enum. More...
 
template<>
int EnumMax< CalibrationAlgoType > ()
 Maximum number of elements in CalibrationAlgoType enum. More...
 
template<>
int EnumMax< ILogger::Severity > ()
 Maximum number of elements in ILogger::Severity enum. More...
 
template<>
int EnumMax< PluginType > ()
 

Detailed Description

The TensorRT API version 1 namespace.

Enumeration Type Documentation

enum nvinfer1::ActivationType : int
strong

Enumerates the types of activation to perform in an activation layer.

Enumerator
kRELU 

Rectified linear activation.

kSIGMOID 

Sigmoid activation.

kTANH 

TanH activation.

enum nvinfer1::CalibrationAlgoType : int
strong

Version of calibration algorithm to use.

enum CalibrationAlgoType

enum nvinfer1::DataType : int
strong

The type of weights and tensors.

Enumerator
kFLOAT 

FP32 format.

kHALF 

FP16 format.

kINT8 

INT8 format.

kINT32 

INT32 format.

enum nvinfer1::DimensionType : int
strong

The type of data encoded across this dimension.

Enumerator
kSPATIAL 

Elements correspond to different spatial data.

kCHANNEL 

Elements correspond to different channels.

kINDEX 

Elements correspond to different batch index.

kSEQUENCE 

Elements correspond to different sequence values.

enum nvinfer1::ElementWiseOperation : int
strong

Enumerates the binary operations that may be performed by an ElementWise layer.

See Also
IElementWiseLayer
Enumerator
kSUM 

Sum of the two elements.

kPROD 

Product of the two elements.

kMAX 

Maximum of the two elements.

kMIN 

Minimum of the two elements.

kSUB 

Substract the second element from the first.

kDIV 

Divide the first element by the second.

kPOW 

The first element to the power of the second element.

enum nvinfer1::LayerType : int
strong

The type values of layer classes.

See Also
ILayer::getType()
Enumerator
kCONVOLUTION 

Convolution layer.

kFULLY_CONNECTED 

Fully connected layer.

kACTIVATION 

Activation layer.

kPOOLING 

Pooling layer.

kLRN 

LRN layer.

kSCALE 

Scale Layer.

kSOFTMAX 

SoftMax layer.

kDECONVOLUTION 

Deconvolution layer.

kCONCATENATION 

Concatenation layer.

kELEMENTWISE 

Elementwise layer.

kPLUGIN 

Plugin layer.

kRNN 

RNN Layer.

kUNARY 

UnaryOp Operation Layer.

kPADDING 

Padding Layer.

kSHUFFLE 

Shuffle Layer.

kREDUCE 

Reduce layer.

kTOPK 

TopK Layer.

kGATHER 

Gather Layer.

kMATRIX_MULTIPLY 

Matrix Multiply Layer.

kRAGGED_SOFTMAX 

Ragged softmax Layer.

kCONSTANT 

Constant Layer.

kRNN_V2 

RNNv2 layer.

enum nvinfer1::PluginFormat : uint8_t
strong
Enumerator
kNCHW 

NCHW.

kNC2HW2 

NCHW with 2-element packed channels.

kNHWC8 

NHWC with 8-element packed channels (C must be a multiple of 8).

enum nvinfer1::PluginType : int
strong

The type values for the various plugins.

See Also
INvPlugin::getPluginType()
Enumerator
kFASTERRCNN 

FasterRCNN fused plugin (RPN + ROI pooling).

kNORMALIZE 

Normalize plugin.

kPERMUTE 

Permute plugin.

kPRIORBOX 

PriorBox plugin.

kSSDDETECTIONOUTPUT 

SSD DetectionOutput plugin.

kCONCAT 

Concat plugin.

kPRELU 

YOLO PReLU Plugin.

kYOLOREORG 

YOLO Reorg Plugin.

kYOLOREGION 

YOLO Region Plugin.

kANCHORGENERATOR 

SSD Grid Anchor Generator.

enum nvinfer1::RNNDirection : int
strong

Enumerates the RNN direction that may be performed by an RNN layer.

See Also
IRNNLayer, IRNNv2Layer
Enumerator
kUNIDIRECTION 

Network iterations from first input to last input.

kBIDIRECTION 

Network iterates from first to last and vice versa and outputs concatenated.

enum nvinfer1::RNNGateType : int
strong

Identifies an individual gate within an RNN cell.

See Also
RNNOperation
Enumerator
kINPUT 

Input gate (i).

kOUTPUT 

Output gate (o).

kFORGET 

Forget gate (f).

kUPDATE 

Update gate (z).

kRESET 

Reset gate (r).

kCELL 

Cell gate (c).

kHIDDEN 

Hidden gate (h).

enum nvinfer1::RNNInputMode : int
strong

Enumerates the RNN input modes that may occur with an RNN layer.

If the RNN is configured with RNNInputMode::kLINEAR, then for each gate g in the first layer of the RNN, the input vector X[t] (length E) is left-multiplied by the gate's corresponding weight matrix W[g] (dimensions HxE) as usual, before being used to compute the gate output as described by RNNOperation.

If the RNN is configured with RNNInputMode::kSKIP, then this initial matrix multiplication is "skipped" and W[g] is conceptually an identity matrix. In this case, the input vector X[t] must have length H (the size of the hidden state).

See Also
IRNNLayer, IRNNv2Layer
Enumerator
kLINEAR 

Perform the normal matrix multiplication in the first recurrent layer.

kSKIP 

No operation is performed on the first recurrent layer.

enum nvinfer1::RNNOperation : int
strong

Enumerates the RNN operations that may be performed by an RNN layer.

Equation definitions

In the equations below, we use the following naming convention:

t := current time step
i := input gate
o := output gate
f := forget gate
z := update gate
r := reset gate
c := cell gate
h := hidden gate
g[t] denotes the output of gate g at timestep t, e.g.
f[t] is the output of the forget gate f.
X[t] := input tensor for timestep t
C[t] := cell state for timestep t
H[t] := hidden state for timestep t
W[g] := W (input) parameter weight matrix for gate g
R[g] := U (recurrent) parameter weight matrix for gate g
Wb[g] := W (input) parameter bias vector for gate g
Rb[g] := U (recurrent) parameter bias vector for gate g
Unless otherwise specified, all operations apply pointwise
to elements of each operand tensor.
ReLU(X) := max(X, 0)
tanh(X) := hyperbolic tangent of X
sigmoid(X) := 1 / (1 + exp(-X))
exp(X) := e^X
A.B denotes matrix multiplication of A and B.
A*B denotes pointwise multiplication of A and B.

Equations

Depending on the value of RNNOperation chosen, each sub-layer of the RNN layer will perform one of the following operations:

::kRELU
H[t] := ReLU(W[i].X[t] + R[i].H[t-1] + Wb[i] + Rb[i])
H[t] := tanh(W[i].X[t] + R[i].H[t-1] + Wb[i] + Rb[i])
i[t] := sigmoid(W[i].X[t] + R[i].H[t-1] + Wb[i] + Rb[i])
f[t] := sigmoid(W[f].X[t] + R[f].H[t-1] + Wb[f] + Rb[f])
o[t] := sigmoid(W[o].X[t] + R[o].H[t-1] + Wb[o] + Rb[o])
c[t] := tanh(W[c].X[t] + R[c].H[t-1] + Wb[c] + Rb[c])
C[t] := f[t]*C[t-1] + i[t]*c[t]
H[t] := o[t]*tanh(C[t])
z[t] := sigmoid(W[z].X[t] + R[z].H[t-1] + Wb[z] + Rb[z])
r[t] := sigmoid(W[r].X[t] + R[r].H[t-1] + Wb[r] + Rb[r])
h[t] := tanh(W[h].X[t] + r[t]*(R[h].H[t-1] + Rb[h]) + Wb[h])
H[t] := (1 - z[t])*h[t] + z[t]*H[t-1]
See Also
IRNNLayer, IRNNv2Layer
Enumerator
kRELU 

Single gate RNN w/ ReLU activation function.

kTANH 

Single gate RNN w/ TANH activation function.

kLSTM 

Four-gate LSTM network w/o peephole connections.

kGRU 

Three-gate network consisting of Gated Recurrent Units.

enum nvinfer1::ScaleMode : int
strong

Controls how scale is applied in a Scale layer.

See Also
IScaleLayer
Enumerator
kUNIFORM 

Identical coefficients across all elements of the tensor.

kCHANNEL 

Per-channel coefficients. The channel dimension is assumed to be the third to last dimension.

kELEMENTWISE 

Elementwise coefficients.

enum nvinfer1::TensorLocation : int
strong

The location for tensor data storage, device or host.

Enumerator
kDEVICE 

Data stored on device.

kHOST 

Data stored on host.

enum nvinfer1::TopKOperation : int
strong

Enumerates the operations that may be performed by a TopK layer.

Enumerator
kMAX 

Maximum of the elements.

kMIN 

Minimum of the elements.

enum nvinfer1::UnaryOperation : int
strong

Enumerates the unary operations that may be performed by a Unary layer.

See Also
IUnaryLayer
Enumerator
kEXP 

Exponentiation.

kLOG 

Log (base e).

kSQRT 

Square root.

kRECIP 

Reciprocal.

kABS 

Absolute value.

kNEG 

Negation.

Function Documentation

template<>
int nvinfer1::EnumMax< ActivationType > ( )
inline

Maximum number of elements in ActivationType enum.

See Also
ActivationType
template<>
int nvinfer1::EnumMax< CalibrationAlgoType > ( )
inline

Maximum number of elements in CalibrationAlgoType enum.

See Also
DataType
template<>
int nvinfer1::EnumMax< DataType > ( )
inline

Maximum number of elements in DataType enum.

See Also
DataType
template<>
int nvinfer1::EnumMax< DimensionType > ( )
inline

Maximum number of elements in DimensionType enum.

See Also
DimensionType
template<>
int nvinfer1::EnumMax< ElementWiseOperation > ( )
inline

Maximum number of elements in ElementWiseOperation enum.

See Also
ElementWiseOperation
template<>
int nvinfer1::EnumMax< ILogger::Severity > ( )
inline

Maximum number of elements in ILogger::Severity enum.

See Also
ILogger::Severity
template<>
int nvinfer1::EnumMax< LayerType > ( )
inline

Maximum number of elements in LayerType enum.

See Also
LayerType
template<>
int nvinfer1::EnumMax< PluginFormat > ( )
inline

Maximum number of elements in PluginFormat enum.

See Also
PluginFormat
template<>
int nvinfer1::EnumMax< PoolingType > ( )
inline

Maximum number of elements in PoolingType enum.

See Also
PoolingType
template<>
int nvinfer1::EnumMax< ReduceOperation > ( )
inline

Maximum number of elements in ReduceOperation enum.

See Also
ReduceOperation
template<>
int nvinfer1::EnumMax< RNNDirection > ( )
inline

Maximum number of elements in RNNDirection enum.

See Also
RNNDirection
template<>
int nvinfer1::EnumMax< RNNGateType > ( )
inline

Maximum number of elements in RNNGateType enum.

See Also
RNNGateType
template<>
int nvinfer1::EnumMax< RNNInputMode > ( )
inline

Maximum number of elements in RNNInputMode enum.

See Also
RNNInputMode
template<>
int nvinfer1::EnumMax< RNNOperation > ( )
inline

Maximum number of elements in RNNOperation enum.

See Also
RNNOperation
template<>
int nvinfer1::EnumMax< ScaleMode > ( )
inline

Maximum number of elements in ScaleMode enum.

See Also
ScaleMode
template<>
int nvinfer1::EnumMax< TensorLocation > ( )
inline

Maximum number of elements in TensorLocation enum.

See Also
TensorLocation
template<>
int nvinfer1::EnumMax< TopKOperation > ( )
inline

Maximum number of elements in TopKOperation enum.

See Also
TopKOperation
template<>
int nvinfer1::EnumMax< UnaryOperation > ( )
inline

Maximum number of elements in UnaryOperation enum.

See Also
UnaryOperation