Table Of Contents
The normalizePlugin
is used for the L2 normalization layer, which is generally used in deep learning models such as ParseNet and SSD during TensorRT inference. This plugin is included in TensorRT and used in sampleSSD to run SSD.
Specifically, given an array of values x = [x_0, x_1, ..., x_n]
and a scale factor, the L2 norm ||x||_2 = sqrt(sum({x_0}^2, {x_1}^2, ..., {x_n}^2)
is calculated and each element in the array is divided by the L2 norm and multiplied by the scale factor.
This plugin takes one input and generates one output. The input is the data from the last layer that is going to be normalized. It has a shape of [N, C, H, W]
, where N
is the batch size, C
is the number of channels, H
is the height, W
is the width. The dimension of the output is exactly the same as the input.
This plugin consists of the plugin creator class NormalizePluginCreator
and the plugin class Normalize
. To create the plugin instance, the following parameters are used:
Type | Parameter | Description |
---|---|---|
bool |
acrossSpatial |
When acrossSpatial = true , the normalization is conducted for each sample from the batch independently, meaning across spatial locations only. This is somewhat similar to instance normalization. When acrossSpatial = false , the normalization is conducted across all samples in the batch and spatial locations. This is somewhat similar to batch normalization. |
bool |
channelShared |
When channelShared = true , a single scale factor is used for all channels. When channelShared = false , several scale factors are provided and are used for each channel independently. |
float |
eps |
A small number to prevent being divided by zero during normalization. |
Weights * |
weights |
A pointer to weights which contains information about scale factors for normalization. The definition of Weights can be found in the NvInfer.h header. The number of values in weights is 1 if channelShared = true , otherwise the number of values in weights is the number of channels in the input tensor. |
int |
nbWeights |
The number of weights sent to the plugin. This value has to be 1 . |
The following resources provide a deeper understanding of the normalizePlugin
plugin:
Networks
For terms and conditions for use, reproduction, and distribution, see the TensorRT Software License Agreement documentation.
May 2019
This is the first release of this README.md
file.
There are no known issues in this plugin.