BatchNorm running statistics: what's left over from the training batch

BatchNorm usually uses current batch statistics during the training phase and maintains the running mean value and variance for reasoning.

• Step by stepCollate in 2 self-measured2 First-hand sources
Start Body
Learning objectives and first steps2 objectives 2 first fixes

Try to do it after reading

  • Push Run Average
  • Distinguishing Parameter Gradients from Statistical Updates

Suggested first

  • Vector and Matrix Operations
  • Counts and chain rules

The weight of the model remains the same, and the output may change

BatchNorm usually uses current batch statistics during the training phase and maintains the running mean value and variance for reasoning. Operational statistics are not usually Parameter, which is a general loss-reverse learning, but they are important for influencing projections. Freezes only the parameter gradient, which does not equal to a certain cessation of change in these states.

To explain the forward, a new run-over average value = (1-m) is agreed to be used + the current batch average value of m, and m is taken at 0.1. The initial running average value is 0 and the first average is 1 after 10; The average value of the second batch became 2.9 after 20. It is not a simple average of 15 averages for both batches, and both early initialization and weighting were involved in the results. A different frame momentum name may use a different side factor, and the formula must be checked for migration.

The current batch mean value may also vary significantly from the running average. The average value of a batch of 20 was used in advance of training, whereas the running value of 2.9 was used for reasoning, and the output may naturally be different. In particular, when data batches are unevenly distributed, small batch or when the proportion of sources changes after training, the representativeness of running statistics should be checked separately, rather than merely whether training loss is declining.

Differences also involve agreements that are biased and non-prejudiced. (a) The batchal deviations used for the standardization of training are not necessarily the same as those used in the operational estimates; It is not possible to calculate the value of all API status values by using one or two samples. The treatment of individual samples and spatial dimensions should also be judged by the specific BN type and input layout.

The train mode is maintained at the time of validation, and even if the package is in no_grad, running statistics may still be updated by validation data, resulting in experimental contamination. In turn, eval mode does not automatically close autograd. If you want to enter a gradient explanation, you can keep the guide in the eval mode, but it must be clear that this is different from the general read-only validation function.

Here the dynamic is defined as the proportion of new statistics; Some interfaces use the share of old statistics, but the symbols are the same and the opposite direction. The migration should be preceded by a push and a comparison of the parameter values. Recovers momentum formulas, initialization values, batch order and mode more reliable than saving only one configuration number named momentum.

Why is it 2.9 instead of 3 after the second?

Old value 1 multiplied by 0.9 plus 20 0.1, obtained 0.9+2 = 2.9, which is index weighted rather than directly added.

All of it. Parameter It's... requires_grad Close, will it stop running mean updates?

This is not usually the basis for assurances. Statistical updates are different from the parameter gradient and require the selection of the right module model and status policy.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. Batch Normalization
  2. D2L — Batch Normalization

Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.

← Back to the knowledge directory
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.