pub struct INormalizationLayer { /* private fields */ }Expand description
INormalizationLayer
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).
Do not inherit from this class, as doing so will break forward-compatibility of the API and ABI.
Implementations§
Source§impl INormalizationLayer
impl INormalizationLayer
Sourcepub fn setEpsilon(self: Pin<&mut INormalizationLayer>, eps: f32)
pub fn setEpsilon(self: Pin<&mut INormalizationLayer>, eps: f32)
Set the epsilon value used for the normalization calculation.
The default value of eps is 1e-5F.
epsThe epsilon value used for the normalization calculation.
Sourcepub fn getEpsilon(self: &INormalizationLayer) -> f32
pub fn getEpsilon(self: &INormalizationLayer) -> f32
Get the epsilon value used for the normalization calculation.
The epsilon value used for the normalization calculation.
Sourcepub fn setAxes(self: Pin<&mut INormalizationLayer>, axesMask: u32)
pub fn setAxes(self: Pin<&mut INormalizationLayer>, axesMask: u32)
Set the reduction axes for the normalization calculation.
axesMaskThe axes used for the normalization calculation.
Sourcepub fn getAxes(self: &INormalizationLayer) -> u32
pub fn getAxes(self: &INormalizationLayer) -> u32
Get the axes value used for the normalization calculation.
The axes used for the normalization calculation.
Sourcepub fn setNbGroups(self: Pin<&mut INormalizationLayer>, nbGroups: i64)
pub fn setNbGroups(self: Pin<&mut INormalizationLayer>, nbGroups: i64)
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.
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.
nbGroupsThe number of groups to split the channels into for the normalization calculation.
Sourcepub fn getNbGroups(self: &INormalizationLayer) -> i64
pub fn getNbGroups(self: &INormalizationLayer) -> i64
Get the number of groups used to split the channels for the normalization calculation.
The number of groups used to split the channel used for the normalization calculation.
Sourcepub fn setComputePrecision(self: Pin<&mut INormalizationLayer>, type_: DataType)
pub fn setComputePrecision(self: Pin<&mut INormalizationLayer>, type_: DataType)
Set the compute precision of this layer.
typeThe datatype used for the compute precision of this layer.
The method is used to avoid overflow errors by controlling the normalization computation in mixed precision mode. The compute precision defaults to DataType::kFLOAT32. To override this default, use this method to set the desired compute precision.
For a weakly typed network:
-
Method setOutputType() can still be called to control the output data type.
-
Method setPrecision() can still be called. The input data is cast to that precision before being cast to the compute precision.
Strongly typed network rejects calls to this method since the compute precision is typically controlled by casting the input tensors to the desired type.
Only DataType::kFLOAT32 and DataType::kHALF are valid types for type.
Deprecated in TensorRT 10.16. Superseded by strong typing.
Sourcepub fn getComputePrecision(self: &INormalizationLayer) -> DataType
pub fn getComputePrecision(self: &INormalizationLayer) -> DataType
Get the compute precision of this layer.
The datatype used for the compute precision of this layer.
Deprecated in TensorRT 10.16. Superseded by strong typing.
Sourcepub fn isV2(self: &INormalizationLayer) -> bool
pub fn isV2(self: &INormalizationLayer) -> bool
Returns true if this layer was created through addNormalizationV2().
Whether the layer was created through addNormalizationV2().