chainer.functions.fixed_batch_normalization

chainer.functions.fixed_batch_normalization(x, gamma, beta, mean, var, eps=2e-05, axis=None)[source]

Batch normalization function with fixed statistics.

This is a variant of batch normalization, where the mean and variance statistics are given by the caller as fixed variables. This is used on testing mode of the batch normalization layer, where batch statistics cannot be used for prediction consistency.

Parameters:
  • x (Variable or numpy.ndarray or cupy.ndarray) – Input variable.
  • gamma (Variable or numpy.ndarray or cupy.ndarray) – Scaling parameter of normalized data.
  • beta (Variable or numpy.ndarray or cupy.ndarray) – Shifting parameter of scaled normalized data.
  • mean (Variable or numpy.ndarray or cupy.ndarray) – Shifting parameter of input.
  • var (Variable or numpy.ndarray or cupy.ndarray) – Square of scaling parameter of input.
  • eps (float) – Epsilon value for numerical stability.
  • axis (int, tuple of int or None) – Axis over which normalization is performed. When axis is None, it is determined from input dimensions. For example, if x.ndim is 4, axis becomes (0, 2, 3) and normalization is performed over 0th, 2nd and 3rd axis of input. If it is 2, axis becomes (0) and normalization is performed over 0th axis of input. When a tuple of int is given to this option, numbers in the tuple must be being sorted in ascending order. For example, (0, 2) is OK, but (2, 0) is not.