TensorRT 8.6.0
nvinfer1::INormalizationLayer Class Reference

A normalization layer in a network definition. More...

#include <NvInfer.h>

Inheritance diagram for nvinfer1::INormalizationLayer:
nvinfer1::ILayer nvinfer1::INoCopy

Public Member Functions

void setEpsilon (float eps) noexcept
 Set the epsilon value used for the normalization calculation. More...
 
float getEpsilon () const noexcept
 Get the epsilon value used for the normalization calculation. More...
 
void setAxes (uint32_t axesMask) noexcept
 Set the reduction axes for the normalization calculation. More...
 
uint32_t getAxes () const noexcept
 Get the axes value used for the normalization calculation. More...
 
void setNbGroups (int32_t nbGroups) noexcept
 Set the number of groups used to split the channels in the normalization calculation. More...
 
int32_t getNbGroups () const noexcept
 Get the number of groups used to split the channels for the normalization calculation. More...
 
void setComputePrecision (DataType type) noexcept
 Set the compute precision of this layer. More...
 
DataType getComputePrecision () const noexcept
 Get the compute precision of this layer. More...
 
- Public Member Functions inherited from nvinfer1::ILayer
LayerType getType () const noexcept
 Return the type of a layer. More...
 
void setName (char const *name) noexcept
 Set the name of a layer. More...
 
char const * getName () const noexcept
 Return the name of a layer. More...
 
int32_t getNbInputs () const noexcept
 Get the number of inputs of a layer. More...
 
ITensorgetInput (int32_t index) const noexcept
 Get the layer input corresponding to the given index. More...
 
int32_t getNbOutputs () const noexcept
 Get the number of outputs of a layer. More...
 
ITensorgetOutput (int32_t index) const noexcept
 Get the layer output corresponding to the given index. More...
 
void setInput (int32_t index, ITensor &tensor) noexcept
 Replace an input of this layer with a specific tensor. More...
 
void setPrecision (DataType dataType) noexcept
 Set the computational precision of this layer. More...
 
DataType getPrecision () const noexcept
 get the computational precision of this layer More...
 
bool precisionIsSet () const noexcept
 whether the computational precision has been set for this layer More...
 
void resetPrecision () noexcept
 reset the computational precision for this layer More...
 
void setOutputType (int32_t index, DataType dataType) noexcept
 Set the output type of this layer. More...
 
DataType getOutputType (int32_t index) const noexcept
 get the output type of this layer More...
 
bool outputTypeIsSet (int32_t index) const noexcept
 whether the output type has been set for this layer More...
 
void resetOutputType (int32_t index) noexcept
 reset the output type for this layer More...
 
void setMetadata (char const *metadata) noexcept
 Set the metadata for this layer. More...
 
char const * getMetadata () const noexcept
 Get the metadata of the layer. More...
 

Protected Member Functions

virtual ~INormalizationLayer () noexcept=default
 
- Protected Member Functions inherited from nvinfer1::ILayer
virtual ~ILayer () noexcept=default
 
- Protected Member Functions inherited from nvinfer1::INoCopy
 INoCopy ()=default
 
virtual ~INoCopy ()=default
 
 INoCopy (INoCopy const &other)=delete
 
INoCopyoperator= (INoCopy const &other)=delete
 
 INoCopy (INoCopy &&other)=delete
 
INoCopyoperator= (INoCopy &&other)=delete
 

Protected Attributes

apiv::VNormalizationLayer * mImpl
 
- Protected Attributes inherited from nvinfer1::ILayer
apiv::VLayer * mLayer
 

Detailed Description

A normalization layer in a network definition.

The normalization layer performs the following operation:

X - input Tensor Y - output Tensor S - scale Tensor B - bias Tensor

Y = (X - Mean(X, axes)) / Sqrt(Variance(X) + epsilon) * S + B

Where Mean(X, axes) is a reduction over a set of axes, and Variance(X) = Mean((X - Mean(X, axes)) ^ 2, axes).

Warning
Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.

Constructor & Destructor Documentation

◆ ~INormalizationLayer()

virtual nvinfer1::INormalizationLayer::~INormalizationLayer ( )
protectedvirtualdefaultnoexcept

Member Function Documentation

◆ getAxes()

uint32_t nvinfer1::INormalizationLayer::getAxes ( ) const
inlinenoexcept

Get the axes value used for the normalization calculation.

Returns
The axes used for the normalization calculation.

◆ getComputePrecision()

DataType nvinfer1::INormalizationLayer::getComputePrecision ( ) const
inlinenoexcept

Get the compute precision of this layer.

Returns
The datatype used for the compute precision of this layer.

◆ getEpsilon()

float nvinfer1::INormalizationLayer::getEpsilon ( ) const
inlinenoexcept

Get the epsilon value used for the normalization calculation.

Returns
The epsilon value used for the normalization calculation.

◆ getNbGroups()

int32_t nvinfer1::INormalizationLayer::getNbGroups ( ) const
inlinenoexcept

Get the number of groups used to split the channels for the normalization calculation.

Returns
The number of groups used to split the channel used for the normalization calculation.

◆ setAxes()

void nvinfer1::INormalizationLayer::setAxes ( uint32_t  axesMask)
inlinenoexcept

Set the reduction axes for the normalization calculation.

Parameters
axesMaskThe axes used for the normalization calculation.

◆ setComputePrecision()

void nvinfer1::INormalizationLayer::setComputePrecision ( DataType  type)
inlinenoexcept

Set the compute precision of this layer.

Parameters
typeThe datatype used for the compute precision of this layer.

By default TensorRT will run the normalization computation in DataType::kFLOAT32 even in mixed precision mode regardless of any set builder flags to avoid overflow errors. To override this default, use this function to set the desired compute precision.

setPrecision() and setOutputPrecision() functions can still be called to control the input and output data types to this layer.

Only DataType::kFLOAT32 and DataType::kHALF are valid types for type.

◆ setEpsilon()

void nvinfer1::INormalizationLayer::setEpsilon ( float  eps)
inlinenoexcept

Set the epsilon value used for the normalization calculation.

The default value of eps is 1e-5F.

Parameters
epsThe epsilon value used for the normalization calculation.

◆ setNbGroups()

void nvinfer1::INormalizationLayer::setNbGroups ( int32_t  nbGroups)
inlinenoexcept

Set the number of groups used to split the channels in the normalization calculation.

The input tensor channels are divided into nbGroups groups, and normalization is performed per group. The channel dimension is considered to be the second dimension in a [N, C, H, W, ...] formatted tensor.

The default nbGroups is 1.

Warning
It is an error to set nbGroups to a value that does not evenly divide into the number of channels of the input tensor.
When nbGroups is != 1, it is expected that the provided axesMask will have all bits corresponding to dimensions after the channel dimension set to 1, with all other bits set to 0.
Parameters
nbGroupsThe number of groups to split the channels into for the normalization calculation.

Member Data Documentation

◆ mImpl

apiv::VNormalizationLayer* nvinfer1::INormalizationLayer::mImpl
protected

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