TensorRT 8.6.1
|
A normalization layer in a network definition. More...
#include <NvInfer.h>
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... | |
![]() | |
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... | |
ITensor * | getInput (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... | |
ITensor * | getOutput (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 |
![]() | |
virtual | ~ILayer () noexcept=default |
![]() | |
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 |
Protected Attributes | |
apiv::VNormalizationLayer * | mImpl |
![]() | |
apiv::VLayer * | mLayer |
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).
|
protectedvirtualdefaultnoexcept |
|
inlinenoexcept |
Get the axes value used for the normalization calculation.
|
inlinenoexcept |
Get the compute precision of this layer.
|
inlinenoexcept |
Get the epsilon value used for the normalization calculation.
|
inlinenoexcept |
Get the number of groups used to split the channels for the normalization calculation.
|
inlinenoexcept |
Set the reduction axes for the normalization calculation.
axesMask | The axes used for the normalization calculation. |
|
inlinenoexcept |
Set the compute precision of this layer.
type | The 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
.
|
inlinenoexcept |
Set the epsilon value used for the normalization calculation.
The default value of eps
is 1e-5F.
eps | The epsilon value used for the normalization calculation. |
|
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.
nbGroups
to a value that does not evenly divide into the number of channels of the input tensor.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.nbGroups | The number of groups to split the channels into for the normalization calculation. |
|
protected |