InstanceNorm1d
- class torch.nn.modules.instancenorm.InstanceNorm1d(num_features, eps=1e-05, momentum=0.1, affine=False, track_running_stats=False, , , ,
Applies Instance Normalization.
This operation applies Instance Normalization over a 2D (unbatched) or 3D (batched) input as described in the paper Instance Normalization: The Missing Ingredient for Fast Stylization.
The mean and standard-deviation are calculated per-dimension separately
for each object in a mini-batch. and are learnable parameter vectors
of size C (where C is the number of features or channels of the input) if affine is True.
The variance is calculated via the biased estimator, equivalent to
torch.var(input, correction=0).
By default, this layer uses instance statistics computed from input data in both training and evaluation modes.
If track_running_stats is set to True, during training this
layer keeps running estimates of its computed mean and variance, which are
then used for normalization during evaluation. The running estimates are
kept with a default momentum of 0.1.
num_features (int) – number of features or channels of the input
eps (float) – a value added to the denominator for numerical stability. Default: 1e-5
momentum (float | None) – the value used for the running_mean and running_var computation. Default: 0.1
affine (bool) – a boolean value that when set to , this module has
learnable affine parameters, initialized the same way as done for batch normalization.
Default:
Input: or
Output: or (same shape as input)
Examples:
>>> # Without Learnable Parameters
>>> m = nn.InstanceNorm1d(100)
>>> # With Learnable Parameters
>>> m = nn.InstanceNorm1d(100, affine=True)
>>> input = torch.randn(20,
Falsetrack_running_stats (bool) – a boolean value that when set to True, this
module tracks the running mean and variance, and when set to False,
this module does not track such statistics and always uses batch
statistics in both training and eval modes. Default: False
bias (bool) – If set to False, the layer will not learn an additive bias (only relevant if
affine is True). Default: True