Batch normalization standardizes intermediate neural-network activations, not only the original input. It helps keep changing layer outputs centered and scaled while a model trains. section 9.3
During training, the layer uses the current mini-batch’s mean and variance. During inference, it uses exponential moving averages collected from training, when a representative batch may not be available. Keras stores these statistics as nontrainable weights, updated during the forward pass rather than by backpropagation. section 7.4.1 section 9.3
Use batch normalization as an architectural pattern:
- Place it after a convolution or dense transformation and before the activation. section 9.3
- Treat its benefit as an empirical engineering practice: the commonly cited internal-covariate-shift explanation is not certain. section 9.3
- Combine it with residual connections when building very deep convolutional networks to maintain stable gradient flow. section 20.6
Keras convolution block
x <- x |> layer_conv_2d(32, 3, use_bias = FALSE) |> layer_batch_normalization() |> layer_activation("relu")








