TensorRT 10.11.0
|
A network definition for input to the builder. More...
#include <NvInfer.h>
Public Member Functions | |
virtual | ~INetworkDefinition () noexcept=default |
ITensor * | addInput (char const *name, DataType type, Dims const &dimensions) noexcept |
Add an input tensor to the network. More... | |
void | markOutput (ITensor &tensor) noexcept |
Mark a tensor as a network output. More... | |
bool | markDebug (ITensor &tensor) noexcept |
Mark a tensor as a debug tensor. More... | |
bool | unmarkDebug (ITensor &tensor) noexcept |
Unmark a tensor as a debug tensor. More... | |
bool | isDebugTensor (nvinfer1::ITensor const &tensor) const noexcept |
Check if a tensor is marked as debug tensor. More... | |
IActivationLayer * | addActivation (ITensor &input, ActivationType type) noexcept |
Add an activation layer to the network. More... | |
ILRNLayer * | addLRN (ITensor &input, int64_t window, float alpha, float beta, float k) noexcept |
Add a LRN layer to the network. More... | |
IScaleLayer * | addScale (ITensor &input, ScaleMode mode, Weights shift, Weights scale, Weights power) noexcept |
Add a Scale layer to the network. More... | |
ISoftMaxLayer * | addSoftMax (ITensor &input) noexcept |
Add a SoftMax layer to the network. More... | |
IConcatenationLayer * | addConcatenation (ITensor *const *inputs, int32_t nbInputs) noexcept |
Add a concatenation layer to the network. More... | |
IElementWiseLayer * | addElementWise (ITensor &input1, ITensor &input2, ElementWiseOperation op) noexcept |
Add an elementwise layer to the network. More... | |
IUnaryLayer * | addUnary (ITensor &input, UnaryOperation operation) noexcept |
Add a unary layer to the network. More... | |
IShuffleLayer * | addShuffle (ITensor &input) noexcept |
Add a shuffle layer to the network. More... | |
IOneHotLayer * | addOneHot (ITensor &indices, ITensor &values, ITensor &depth, int32_t axis) noexcept |
Add a OneHot layer to the network. More... | |
int32_t | getNbLayers () const noexcept |
Get the number of layers in the network. More... | |
ILayer * | getLayer (int32_t index) const noexcept |
Get the layer specified by the given index. More... | |
int32_t | getNbInputs () const noexcept |
Get the number of inputs in the network. More... | |
ITensor * | getInput (int32_t index) const noexcept |
Get the input tensor specified by the given index. More... | |
int32_t | getNbOutputs () const noexcept |
Get the number of outputs in the network. More... | |
ITensor * | getOutput (int32_t index) const noexcept |
Get the output tensor specified by the given index. More... | |
IReduceLayer * | addReduce (ITensor &input, ReduceOperation operation, uint32_t reduceAxes, bool keepDimensions) noexcept |
Add a reduce layer to the network. More... | |
ITopKLayer * | addTopK (ITensor &input, TopKOperation op, int32_t k, uint32_t reduceAxes) noexcept |
Add a TopK layer to the network. More... | |
IGatherLayer * | addGather (ITensor &data, ITensor &indices, int32_t axis) noexcept |
Add gather with mode GatherMode::kDEFAULT and specified axis and nbElementWiseDims=0. More... | |
IGatherLayer * | addGatherV2 (ITensor &data, ITensor &indices, GatherMode mode) noexcept |
Add gather with specified mode, axis=0 and nbElementWiseDims=0. More... | |
IRaggedSoftMaxLayer * | addRaggedSoftMax (ITensor &input, ITensor &bounds) noexcept |
Add a RaggedSoftMax layer to the network. More... | |
IMatrixMultiplyLayer * | addMatrixMultiply (ITensor &input0, MatrixOperation op0, ITensor &input1, MatrixOperation op1) noexcept |
Add a MatrixMultiply layer to the network. More... | |
INonZeroLayer * | addNonZero (ITensor &input) noexcept |
Add a nonzero layer to the network. More... | |
IConstantLayer * | addConstant (Dims const &dimensions, Weights weights) noexcept |
Add a constant layer to the network. More... | |
IIdentityLayer * | addIdentity (ITensor &input) noexcept |
Add an identity layer. More... | |
ICastLayer * | addCast (ITensor &input, DataType toType) noexcept |
Add a cast layer. More... | |
void | removeTensor (ITensor &tensor) noexcept |
remove a tensor from the network definition. More... | |
void | unmarkOutput (ITensor &tensor) noexcept |
unmark a tensor as a network output. More... | |
TRT_DEPRECATED IPluginV2Layer * | addPluginV2 (ITensor *const *inputs, int32_t nbInputs, IPluginV2 &plugin) noexcept |
Add a plugin layer to the network using the IPluginV2 interface. More... | |
IPluginV3Layer * | addPluginV3 (ITensor *const *inputs, int32_t nbInputs, ITensor *const *shapeInputs, int32_t nbShapeInputs, IPluginV3 &plugin) noexcept |
Add a plugin layer implementing the IPluginV3 interface to the network. More... | |
ISliceLayer * | addSlice (ITensor &input, Dims const &start, Dims const &size, Dims const &stride) noexcept |
Add a slice layer to the network. More... | |
void | setName (char const *name) noexcept |
Sets the name of the network. More... | |
char const * | getName () const noexcept |
Returns the name associated with the network. More... | |
IShapeLayer * | addShape (ITensor &input) noexcept |
Add a shape layer to the network. More... | |
TRT_DEPRECATED bool | hasImplicitBatchDimension () const noexcept |
Query whether the network was created with an implicit batch dimension. More... | |
NetworkDefinitionCreationFlags | getFlags () const noexcept |
Get the network definition creation flags for this network definition object. Defaults to 0. More... | |
bool | getFlag (NetworkDefinitionCreationFlag networkDefinitionCreationFlag) const noexcept |
Returns true if the network definition creation flag is set. More... | |
bool | markOutputForShapes (ITensor &tensor) noexcept |
Enable tensor's value to be computed by IExecutionContext::getShapeBinding. More... | |
bool | unmarkOutputForShapes (ITensor &tensor) noexcept |
Undo markOutputForShapes. More... | |
IParametricReLULayer * | addParametricReLU (ITensor &input, ITensor &slope) noexcept |
Add a parametric ReLU layer to the network. More... | |
IConvolutionLayer * | addConvolutionNd (ITensor &input, int64_t nbOutputMaps, Dims const &kernelSize, Weights kernelWeights, Weights biasWeights) noexcept |
Add a multi-dimension convolution layer to the network. More... | |
IPoolingLayer * | addPoolingNd (ITensor &input, PoolingType type, Dims const &windowSize) noexcept |
Add a multi-dimension pooling layer to the network. More... | |
IDeconvolutionLayer * | addDeconvolutionNd (ITensor &input, int64_t nbOutputMaps, Dims kernelSize, Weights kernelWeights, Weights biasWeights) noexcept |
Add a multi-dimension deconvolution layer to the network. More... | |
IScaleLayer * | addScaleNd (ITensor &input, ScaleMode mode, Weights shift, Weights scale, Weights power, int32_t channelAxis) noexcept |
Add a multi-dimension scale layer to the network. More... | |
IResizeLayer * | addResize (ITensor &input) noexcept |
Add a resize layer to the network. More... | |
ILoop * | addLoop () noexcept |
Add a loop to the network. More... | |
IIfConditional * | addIfConditional () noexcept |
Add an if-then-else to the network. More... | |
ISelectLayer * | addSelect (ITensor &condition, ITensor &thenInput, ITensor &elseInput) noexcept |
Add a select layer to the network. More... | |
IAssertionLayer * | addAssertion (ITensor &condition, char const *message) noexcept |
Add an assertion layer to the network. More... | |
TRT_DEPRECATED IFillLayer * | addFill (Dims const &dimensions, FillOperation op) noexcept |
Add a fill layer to the network. More... | |
IFillLayer * | addFill (Dims const &dimensions, FillOperation op, DataType outputType) noexcept |
Add a fill layer to the network. More... | |
IPaddingLayer * | addPaddingNd (ITensor &input, Dims const &prePadding, Dims const &postPadding) noexcept |
Add a padding layer to the network. Only 2D padding is currently supported. More... | |
bool | setWeightsName (Weights weights, char const *name) noexcept |
Associate a name with all current uses of the given weights. More... | |
void | setErrorRecorder (IErrorRecorder *recorder) noexcept |
Set the ErrorRecorder for this interface. More... | |
IErrorRecorder * | getErrorRecorder () const noexcept |
get the ErrorRecorder assigned to this interface. More... | |
TRT_DEPRECATED IDequantizeLayer * | addDequantize (ITensor &input, ITensor &scale) noexcept |
Add a dequantization layer to the network. More... | |
IDequantizeLayer * | addDequantize (ITensor &input, ITensor &scale, DataType outputType) noexcept |
Add a dequantization layer to the network. More... | |
IScatterLayer * | addScatter (ITensor &data, ITensor &indices, ITensor &updates, ScatterMode mode) noexcept |
Add a Scatter layer to the network with specified mode and axis=0. More... | |
TRT_DEPRECATED IQuantizeLayer * | addQuantize (ITensor &input, ITensor &scale) noexcept |
Add a quantization layer to the network. More... | |
IQuantizeLayer * | addQuantize (ITensor &input, ITensor &scale, DataType outputType) noexcept |
Add a quantization layer to the network. More... | |
IDynamicQuantizeLayer * | addDynamicQuantize (ITensor &input, int32_t axis, int32_t blockSize, DataType outputType, DataType scaleType) noexcept |
Add a dynamic quantization layer to the network. More... | |
IEinsumLayer * | addEinsum (ITensor *const *inputs, int32_t nbInputs, char const *equation) noexcept |
Add an Einsum layer to the network. More... | |
IGridSampleLayer * | addGridSample (ITensor &input, ITensor &grid) noexcept |
Add a GridSample layer to the network. More... | |
INMSLayer * | addNMS (ITensor &boxes, ITensor &scores, ITensor &maxOutputBoxesPerClass) noexcept |
Add a non-maximum suppression layer to the network. More... | |
IReverseSequenceLayer * | addReverseSequence (ITensor &input, ITensor &sequenceLens) noexcept |
Add a ReverseSequence layer to the network. More... | |
INormalizationLayer * | addNormalization (ITensor &input, ITensor &scale, ITensor &bias, uint32_t axesMask) noexcept |
Add a normalization layer to the network. More... | |
ICumulativeLayer * | addCumulative (ITensor &input, ITensor &axis, CumulativeOperation operation, bool exclusive, bool reverse) noexcept |
Add a cumulative layer to the network. More... | |
virtual IBuilder & | getBuilder () const noexcept |
Return the builder from which this INetworkDefinition was created. More... | |
bool | markWeightsRefittable (char const *name) noexcept |
Mark weights as refittable when the builder flag kREFIT_INDIVIDUAL is set. More... | |
bool | unmarkWeightsRefittable (char const *name) noexcept |
Unmark weights as refittable when the builder flag kREFIT_INDIVIDUAL is set. More... | |
bool | areWeightsMarkedRefittable (char const *name) const noexcept |
Whether the weight has been marked as refittable. More... | |
ISqueezeLayer * | addSqueeze (ITensor &input, ITensor &axes) noexcept |
Add a squeeze layer to the network. More... | |
IUnsqueezeLayer * | addUnsqueeze (ITensor &input, ITensor &axes) noexcept |
Add an unsqueeze layer to the network. More... | |
Protected Attributes | |
apiv::VNetworkDefinition * | mImpl |
Additional Inherited Members | |
![]() | |
INoCopy ()=default | |
virtual | ~INoCopy ()=default |
INoCopy (INoCopy const &other)=delete | |
INoCopy & | operator= (INoCopy const &other)=delete |
INoCopy (INoCopy &&other)=delete | |
INoCopy & | operator= (INoCopy &&other)=delete |
A network definition for input to the builder.
A network definition defines the structure of the network, and combined with a IBuilderConfig, is built into an engine using an IBuilder. An INetworkDefinition can have all dimensions explicit, full dims mode, in the network definition. The former mode, i.e. the implicit batch size mode, has been deprecated.
A network with implicit batch dimensions returns the dimensions of a layer without the implicit dimension, and instead the batch is specified at execute/enqueue time. If the network has all dimensions specified, then the first dimension follows elementwise broadcast rules: if it is 1 for some inputs and is some value N for all other inputs, then the first dimension of each output is N, and the inputs with 1 for the first dimension are broadcast. Having divergent batch sizes across inputs to a layer is not supported.
|
virtualdefaultnoexcept |
|
inlinenoexcept |
Add an activation layer to the network.
input | The input tensor to the layer. |
type | The type of activation function to apply. |
Note that the setAlpha() and setBeta() methods must be used on the output for activations that require these parameters.
|
inlinenoexcept |
Add an assertion layer to the network.
condition | The input tensor to the layer. |
message | A message to print if the assertion fails. |
The input tensor must be a boolean shape tensor.
|
inlinenoexcept |
Add a cast layer.
input | The input tensor to the layer. |
toType | The DataType of the output tensor |
|
inlinenoexcept |
Add a concatenation layer to the network.
inputs | The input tensors to the layer. |
nbInputs | The number of input tensors. |
|
inlinenoexcept |
Add a constant layer to the network.
dimensions | The dimensions of the constant. |
weights | The constant value, represented as weights. |
If weights.type is DataType::kINT32, the output is a tensor of 32-bit indices. Otherwise the output is a tensor of real values and the output type will be follow TensorRT's normal precision rules.
If a wildcard dimension is used, the volume of the runtime dimensions must equal the number of weights specified.
|
inlinenoexcept |
Add a multi-dimension convolution layer to the network.
input | The input tensor to the convolution. |
nbOutputMaps | The number of output feature maps for the convolution. |
kernelSize | The multi-dimensions of the convolution kernel. |
kernelWeights | The kernel weights for the convolution. |
biasWeights | The bias weights for the convolution. Weights{} represents no bias. |
|
inlinenoexcept |
Add a cumulative layer to the network.
input | The input tensor to the layer. |
axis | The axis tensor to apply the cumulative operation on. Currently, it must be a build-time constant 0D shape tensor and must be in the range [-rank(input), rank(input)-1]. Negative value means counting dimensions from the back. |
operation | The reduction operation to perform. |
exclusive | The boolean that specifies whether it is an exclusive cumulative or inclusive cumulative. |
reverse | The boolean that specifies whether the cumulative operation should be applied backward. |
The cumulative layer works by performing the specified cumulative operation
to the tensor input
on the axis specified by axis
.
|
inlinenoexcept |
Add a multi-dimension deconvolution layer to the network.
input | The input tensor to the layer. |
nbOutputMaps | The number of output feature maps. |
kernelSize | The multi-dimensions of the deconvolution kernel. |
kernelWeights | The kernel weights for the deconvolution. |
biasWeights | The bias weights for the deconvolution. Weights{} represents no bias. |
|
inlinenoexcept |
Add a dequantization layer to the network.
input | The input tensor to be quantized. |
scale | A tensor with the scale value. |
input
tensor data type must be DataType::kINT8 or DataType::kFP8. scale
tensor data type must be DataType::kFLOAT. The subgraph which terminates with the scale
tensor must be a build-time constant.
|
inlinenoexcept |
Add a dequantization layer to the network.
input | The input tensor to be dequantized. |
scale | A tensor with the scale value. |
outputType | Output tensor data type. |
input
tensor data type must be DataType::kINT8, DataType::kFP8 or DataType::kINT4. scale
tensor data type defaults to DataType::kFLOAT. For strongly typed networks, it must be the same as the output data type. The subgraph which terminates with the scale
tensor must be a build-time constant. outputType
output tensor data type, default value is DataType::kFLOAT. Future calls to set output type using setToType or setOutputType must be consistent. For strongly typed networks, it must be the same as the scale data type.
|
inlinenoexcept |
Add a dynamic quantization layer to the network.
This layer performs dynamic block quantization of its input tensor and outputs the quantized data and the computed block scale-factors. The block size is currently limited to 16 and the size of the blocked axis must be divisible by 16.
input | The input tensor to be quantized. Its data type must be one of DataType::kFLOAT, DataType::kHALF, or DataType::kBF16. Currently only 2D and 3D inputs are supported. |
axis | The axis that is sliced into blocks. The axis must be the last or second to last dimension. |
blockSize | The number of elements that are quantized using a shared scale factor. Currently only blocks of 16 elements are supported. |
outputType | The data type of the quantized output tensor, must be DataType::kFP4. Future calls to set output type using setToType or setOutputType must be consistent. |
scaleType | The data type of the scale factor used for quantizing the input data, must be DataType::kFP8. |
|
inlinenoexcept |
Add an Einsum layer to the network.
inputs | The input tensors to the layer. |
nbInputs | The number of input tensors. |
equation | The equation of the layer |
|
inlinenoexcept |
Add an elementwise layer to the network.
input1 | The first input tensor to the layer. |
input2 | The second input tensor to the layer. |
op | The binary operation that the layer applies. |
The input tensors must have the same rank and compatible type. Two types are compatible if they are the same type or are both in the set {kFLOAT, kHALF}. For each dimension, their lengths must match, or one of them must be one. In the latter case, the tensor is broadcast along that axis.
The output tensor has the same rank as the inputs. For each dimension, its length is the maximum of the lengths of the corresponding input dimension.
The inputs are shape tensors if the output is a shape tensor.
|
inlinenoexcept |
Add a fill layer to the network.
dimensions | The output tensor dimensions if input 0 is missing. |
op | The fill operation that the layer applies. |
This layer is non-deterministic across subsequent calls as the same inputs will produce different output tensors if op
is either FillOperation::kRANDOM_UNIFORM or FillOperation::kRANDOM_NORMAL due to random state being shared across calls. The output tensors generated are determinstic when starting from the same initial state.
|
inlinenoexcept |
Add a fill layer to the network.
dimensions | The output tensor dimensions if input 0 is missing. |
op | The fill operation that the layer applies. |
outputType | Optional output tensor data type, must be DataType::kFLOAT, DataType::kHALF, DataType::kINT32, or DataType::kINT64. This parameter is only used for static alpha/beta. Future calls to set output type using setToType or setOutputType must be consistent. |
This layer is non-deterministic across subsequent calls as the same inputs will produce different output tensors if op
is either FillOperation::kRANDOM_UNIFORM or FillOperation::kRANDOM_NORMAL due to random state being shared across calls. The output tensors generated are deterministic when starting from the same initial state.
|
inlinenoexcept |
Add gather with mode GatherMode::kDEFAULT and specified axis and nbElementWiseDims=0.
data | The tensor to gather values from. |
indices | The tensor to get indices from to populate the output tensor. |
axis | The axis in the data tensor to gather on. |
|
inlinenoexcept |
Add gather with specified mode, axis=0 and nbElementWiseDims=0.
data | The tensor to gather values from. |
indices | The tensor to get indices from to populate the output tensor. |
mode | The gather mode. |
|
inlinenoexcept |
Add a GridSample layer to the network.
input | The input tensor to the layer. |
grid | The grid tensor to the layer. |
Creates a GridSample layer with a InterpolationMode::kLINEAR, unaligned corners, and SampleMode::kFILL for 4d-shape input tensors.
|
inlinenoexcept |
Add an identity layer.
input | The input tensor to the layer. |
|
inlinenoexcept |
Add an if-then-else to the network.
An IIfConditional provides a way to conditionally execute parts of the network.
|
inlinenoexcept |
Add an input tensor to the network.
Each input and output tensor must have a unique name.
For networks with wildcard dimensions, the volume is based on the maxima specified by an IOptimizationProfile.Dimensions are normally non-negative integers. The exception is that in networks with all explicit dimensions, -1 can be used as a wildcard for a dimension to be specified at runtime. Input tensors with such a wildcard must have a corresponding entry in the IOptimizationProfiles indicating the permitted extrema, and the input dimensions must be set by IExecutionContext::setInputShape. Different IExecutionContext instances can have different dimensions. Wildcard dimensions are only supported for EngineCapability::kSTANDARD. They are not supported in safety contexts. DLA does not support Wildcard dimensions.
Tensor dimensions are specified independent of format. For example, if a tensor is formatted in "NHWC" or a vectorized format, the dimensions are still specified in the order{N, C, H, W}. For 2D images with a channel dimension, the last three dimensions are always {C,H,W}. For 3D images with a channel dimension, the last four dimensions are always {C,D,H,W}.
name | The name of the tensor. |
type | The type of the data held in the tensor. |
dimensions | The dimensions of the tensor. |
|
inlinenoexcept |
|
inlinenoexcept |
Add a LRN layer to the network.
input | The input tensor to the layer. |
window | The size of the window. |
alpha | The alpha value for the LRN computation. |
beta | The beta value for the LRN computation. |
k | The k value for the LRN computation. |
|
inlinenoexcept |
Add a MatrixMultiply layer to the network.
input0 | The first input tensor (commonly A). |
op0 | The operation to apply to input0. |
input1 | The second input tensor (commonly B). |
op1 | The operation to apply to input1. |
The inputs are shape tensors if the output is a shape tensor.
|
inlinenoexcept |
Add a non-maximum suppression layer to the network.
boxes | The input boxes tensor to the layer. |
scores | The input scores tensor to the layer. |
maxOutputBoxesPerClass | The input maxOutputBoxesPerClass tensor to the layer. |
|
inlinenoexcept |
Add a nonzero layer to the network.
input | The input tensor to the layer. |
|
inlinenoexcept |
Add a normalization layer to the network.
input | The input tensor to the layer. |
scale | The scale tensor used to scale the normalized output. |
bias | The bias tensor used to scale the normalized output. |
axesMask | The axes on which to perform mean calculations. The bit in position i of bitmask axesMask corresponds to explicit dimension i of the result. E.g., the least significant bit corresponds to the first explicit dimension and the next to least significant bit corresponds to the second explicit dimension. |
The normalization layer works by performing normalization of the tensor input
on the specified axesMask
. The result is then scaled by multiplying with scale
and adding bias
.
The shape of scale
and bias
are expected the be the same, and must have the same rank and be unidirectionally broadcastable to the shape of input
.
|
inlinenoexcept |
Add a OneHot layer to the network.
indices | - tensor containing indices where on_value should be set. |
values | - a 2-element tensor, consisting of [off_value, on_value]. |
depth | - a shape tensor containing the width of the added one-hot dimension. |
axis | - the axis to add the one-hot encoding to. |
|
inlinenoexcept |
Add a padding layer to the network. Only 2D padding is currently supported.
input | The input tensor to the layer. |
prePadding | The padding to apply to the start of the tensor. |
postPadding | The padding to apply to the end of the tensor. |
|
inlinenoexcept |
Add a parametric ReLU layer to the network.
input | The input tensor to the layer. |
slope | The slope tensor to the layer. This tensor should be unidirectionally broadcastable to the input tensor. |
|
inlinenoexcept |
Add a plugin layer to the network using the IPluginV2 interface.
inputs | The input tensors to the layer. |
nbInputs | The number of input tensors. |
plugin | The layer plugin. |
|
inlinenoexcept |
Add a plugin layer implementing the IPluginV3 interface to the network.
inputs | The input tensors to the layer. |
nbInputs | The number of input tensors. |
shapeInputs | Shape tensor inputs to the layer. |
nbShapeInputs | The number of shape tensor inputs. |
plugin | The layer plugin. |
|
inlinenoexcept |
Add a multi-dimension pooling layer to the network.
input | The input tensor to the layer. |
type | The type of pooling to apply. |
windowSize | The size of the pooling window. |
|
inlinenoexcept |
Add a quantization layer to the network.
input | The input tensor to be quantized. |
scale | A tensor with the scale value. |
input
tensor data type must be DataType::kFLOAT or DataType::kHALF. scale
tensor data type must be DataType::kFLOAT. The subgraph which terminates with the scale
tensor must be a build-time constant.
|
inlinenoexcept |
Add a quantization layer to the network.
input | The input tensor to be quantized. |
scale | A tensor with the scale value. |
outputType | Output tensor data type. |
input
tensor data type must be DataType::kFLOAT, DataType::kHALF or DataType::kBF16. scale
tensor data type defaults to DataType::kFLOAT. For strongly typed networks, it must have the same data type as the input. The subgraph which terminates with the scale
tensor must be a build-time constant. outputType
output tensor data type, must be DataType::kINT8 (default), DataType::kFP8 or DataType::kINT4. Future calls to set output type using setToType or setOutputType must be consistent.
|
inlinenoexcept |
Add a RaggedSoftMax layer to the network.
input | The ZxS input tensor. |
bounds | The Zx1 bounds tensor. |
|
inlinenoexcept |
Add a reduce layer to the network.
input | The input tensor to the layer. |
operation | The reduction operation to perform. |
reduceAxes | The reduction dimensions. The bit in position i of bitmask reduceAxes corresponds to explicit dimension i if result. E.g., the least significant bit corresponds to the first explicit dimension and the next to least significant bit corresponds to the second explicit dimension. |
keepDimensions | The boolean that specifies whether or not to keep the reduced dimensions in the output of the layer. |
The reduce layer works by performing an operation specified by operation
to reduce the tensor input
across the axes specified by reduceAxes
.
|
inlinenoexcept |
Add a resize layer to the network.
input | The input tensor to the layer. |
|
inlinenoexcept |
Add a ReverseSequence layer to the network.
input | The input tensor to the layer. Must have rank >= 2. |
sequenceLens | 1D tensor specifying lengths of sequences to reverse in a batch. The length of the sequenceLens tensor must be equal to the size of the dimension in input tensor specified by batchAxis. |
|
inlinenoexcept |
Add a Scale layer to the network.
input | The input tensor to the layer. This tensor must have at least 4 dimensions. |
mode | The scaling mode. |
shift | The shift value. |
scale | The scale value. |
power | The power value. |
If the weights are available, then the size of weights are dependent on the ScaleMode. For ScaleMode::kUNIFORM, the number of weights equals 1. For ScaleMode::kCHANNEL, the number of weights equals the channel dimension. For ScaleMode::kELEMENTWISE, the number of weights equals the product of the last three dimensions of the input.
|
inlinenoexcept |
Add a multi-dimension scale layer to the network.
input | The input tensor to the layer. |
mode | The scaling mode. |
shift | The shift value. |
scale | The scale value. |
power | The power value. |
channelAxis | The channel axis. |
If the weights are available, then the size of weights are dependent on the ScaleMode. For ScaleMode::kUNIFORM, the number of weights equals 1. For ScaleMode::kCHANNEL, the number of weights equals the channel dimension. For ScaleMode::kELEMENTWISE, the number of weights equals the product of all input dimensions at channelAxis and beyond.
For example, if the inputs dimensions are [A,B,C,D,E,F], and channelAxis=2: For ScaleMode::kUNIFORM, the number of weights is equal to 1. For ScaleMode::kCHANNEL, the number of weights is C. For ScaleMode::kELEMENTWISE, the number of weights is C*D*E*F.
channelAxis can also be set explicitly using setChannelAxis().
|
inlinenoexcept |
Add a Scatter layer to the network with specified mode and axis=0.
data | The input tensor to be updated with additional values. |
indices | indices of the elements to be updated. |
updates | values to be used for updates. |
mode | scatter mode. |
indices
tensor data type must be DataType::kINT32. updates
tensor data type must be the same as data
|
inlinenoexcept |
Add a select layer to the network.
condition | The condition tensor to the layer. Must have type DataType::kBOOL. |
thenInput | The "then" input tensor to the layer. |
elseInput | The "else" input tensor to the layer. |
All three input tensors must have the same rank, and along each axis must have the same length or a length of one. If the length is one, the tensor is broadcast along that axis. The output tensor has the dimensions of the inputs AFTER the broadcast rule is applied. For example, given:
dimensions of condition: [1,1,5,9] dimensions of thenInput: [1,1,5,9] dimensions of elseInput: [1,3,1,9]
the output dimensions are [1,3,5,9], and the output contents are defined by:
output[0,i,j,k] = condition[0,0,j,k] ? thenInput[0,0,j,k] : elseInput[0,i,0,k]
The output dimensions are not necessarily the max of the input dimensions if any input is an empty tensor. For example, if in the preceding example, 5 is changed to 0:
dimensions of condition: [1,1,0,9] dimensions of thenInput: [1,1,0,9] dimensions of elseInput: [1,3,1,9]
then the output dimensions are [1,3,0,9].
The inputs are shape tensors if the output is a shape tensor.
|
inlinenoexcept |
Add a shape layer to the network.
input | The input tensor to the layer. |
|
inlinenoexcept |
Add a shuffle layer to the network.
input | The input tensor to the layer. |
|
inlinenoexcept |
Add a slice layer to the network.
input | The input tensor to the layer. |
start | The start offset |
size | The output dimension |
stride | The slicing stride |
Positive, negative, zero stride values, and combinations of them in different dimensions are allowed.
|
inlinenoexcept |
Add a SoftMax layer to the network.
|
inlinenoexcept |
Add a squeeze layer to the network.
input | The input tensor to the layer. |
axes | The axes to remove unit dimensions on. |
Axes must be resolvable to a constant Int32 or Int64 1D shape tensor. Values in axes must be unique and in the range of [-r, r-1], where r is the rank of the input tensor. For each axis value, the corresponding dimension in the input tensor must be one.
|
inlinenoexcept |
Add a TopK layer to the network.
The TopK layer has two outputs of the same dimensions. The first contains data values, the second contains index positions for the values. Output values are sorted, largest first for operation kMAX and smallest first for operation kMIN.
Currently only values of K up to 3840 are supported.
input | The input tensor to the layer. |
op | Operation to perform. |
k | The number of elements to keep. For dynamic k, use the setInput() method to pass in k as a tensor instead, which will override the static k value passed here in calculations. |
reduceAxes | The reduction dimensions. The bit in position i of bitmask reduceAxes corresponds to explicit dimension i of the result. E.g., the least significant bit corresponds to the first explicit dimension and the next to least significant bit corresponds to the second explicit dimension. |
Currently reduceAxes must specify exactly one dimension, and it must be one of the last four dimensions.
|
inlinenoexcept |
Add a unary layer to the network.
input | The input tensor to the layer. |
operation | The operation to apply. |
Generally the input must have a floating-point type (or kINT8 as a quantized float), except for the following operations:
The input is a shape tensor if the output is a shape tensor.
|
inlinenoexcept |
Add an unsqueeze layer to the network.
input | The input tensor to the layer. |
axes | The axes to add unit dimensions. |
Axes must be resolvable to a constant Int32 or Int64 shape tensor. Values in axes must be unique and in the range of [-r_final, r_final-1], where r_final is the sum of rank(input) and len(axes).
r_final must be less than Dims::MAX_DIMS.
|
inlinenoexcept |
Whether the weight has been marked as refittable.
name | The name of the weights to check. |
|
inlinevirtualnoexcept |
Return the builder from which this INetworkDefinition was created.
|
inlinenoexcept |
get the ErrorRecorder assigned to this interface.
Retrieves the assigned error recorder object for the given class. A nullptr will be returned if setErrorRecorder has not been called.
|
inlinenoexcept |
Returns true if the network definition creation flag is set.
|
inlinenoexcept |
Get the network definition creation flags for this network definition object. Defaults to 0.
|
inlinenoexcept |
Get the input tensor specified by the given index.
index | The index of the input tensor. |
|
inlinenoexcept |
Get the layer specified by the given index.
index | The index of the layer. |
|
inlinenoexcept |
Returns the name associated with the network.
The memory pointed to by getName() is owned by the INetworkDefinition object.
|
inlinenoexcept |
Get the number of inputs in the network.
|
inlinenoexcept |
Get the number of layers in the network.
|
inlinenoexcept |
Get the number of outputs in the network.
The outputs include those marked by markOutput or markOutputForShapes.
|
inlinenoexcept |
Get the output tensor specified by the given index.
index | The index of the output tensor. |
|
inlinenoexcept |
Query whether the network was created with an implicit batch dimension.
|
inlinenoexcept |
Check if a tensor is marked as debug tensor.
|
inlinenoexcept |
Mark a tensor as a debug tensor.
A debug tensor can be optionally emitted at runtime. Note that tensor names are required to specify debug tensors at runtime.
tensor | Tensor to be marked as debug |
|
inlinenoexcept |
Mark a tensor as a network output.
tensor | The tensor to mark as an output tensor. |
|
inlinenoexcept |
Enable tensor's value to be computed by IExecutionContext::getShapeBinding.
The tensor must be of type DataType::kINT32 and have no more than one dimension.
|
inlinenoexcept |
Mark weights as refittable when the builder flag kREFIT_INDIVIDUAL is set.
name | The name of the weights. |
|
inlinenoexcept |
remove a tensor from the network definition.
tensor | the tensor to remove |
It is illegal to remove a tensor that is the input or output of a layer. if this method is called with such a tensor, a warning will be emitted on the log and the call will be ignored. Its intended use is to remove detached tensors after e.g. concatenating two networks with Layer::setInput().
|
inlinenoexcept |
Set the ErrorRecorder for this interface.
Assigns the ErrorRecorder to this interface. The ErrorRecorder will track all errors during execution. This function will call incRefCount of the registered ErrorRecorder at least once. Setting recorder to nullptr unregisters the recorder with the interface, resulting in a call to decRefCount if a recorder has been registered.
If an error recorder is not set, messages will be sent to the global log stream.
recorder | The error recorder to register with this interface. |
|
inlinenoexcept |
Sets the name of the network.
name | The name to assign to this network. |
Set the name of the network so that it can be associated with a built engine. The name
must be a null-terminated C-style string. TensorRT makes no use of this string except storing it as part of the engine so that it may be retrieved at runtime. A name unique to the builder will be generated by default.
This method copies the name string.
|
inlinenoexcept |
Associate a name with all current uses of the given weights.
The name must be set after the Weights are used in the network. Lookup is associative. The name applies to all Weights with matching type, value pointer, and count. If Weights with a matching value pointer, but different type or count exists in the network, an error message is issued, the name is rejected, and return false. If the name has already been used for other weights, return false. A nullptr causes the weights to become unnamed, i.e. clears any previous name.
weights | The weights to be named. |
name | The name to associate with the weights. |
|
inlinenoexcept |
Unmark a tensor as a debug tensor.
Remove the marking of a tensor as a debug tensor.
tensor | Tensor to be unmarked as debug. |
|
inlinenoexcept |
unmark a tensor as a network output.
tensor | The tensor to unmark as an output tensor. |
see markOutput()
|
inlinenoexcept |
Undo markOutputForShapes.
|
inlinenoexcept |
Unmark weights as refittable when the builder flag kREFIT_INDIVIDUAL is set.
name | The name of the weights. |
|
protected |
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