megengine.functional.nn.batch_norm¶
- batch_norm(inp, running_mean=None, running_var=None, weight=None, bias=None, *, training=False, momentum=0.9, eps=1e-05, inplace=True)[source]¶
- Applies batch normalization to the input. - Refer to - BatchNorm2dand- BatchNorm1dfor more information.- Parameters
- inp ( - Tensor) – input tensor.
- running_mean ( - Optional[- Tensor]) – tensor to store running mean.
- running_var ( - Optional[- Tensor]) – tensor to store running variance.
- weight ( - Optional[- Tensor]) – scaling tensor in the learnable affine parameters. See \(\gamma\) in- BatchNorm2d.
- bias ( - Optional[- Tensor]) – bias tensor in the learnable affine parameters. See \(\beta\) in- BatchNorm2d.
- training ( - bool) – a boolean value to indicate whether batch norm is performed in training mode. Default: False
- momentum ( - float) – value used for the- running_meanand- running_varcomputation. Default: 0.9
- eps ( - float) – a value added to the denominator for numerical stability. Default: 1e-5
- inplace ( - bool) – whether to update- running_meanand- running_varinplace or return new tensors. Default: True
- compute_mode – When set to ‘default’, no special requirements will be placed on the precision of intermediate results. When set to ‘float32’, float32 would be used for accumulator and intermediate result, but only effective when input and output are of float16 dtype. 
- param_dim – a value indicating in which format the parameters are. Default: ‘dim_1c11’, which means NCHW format. And ‘dim_111c’ means NHWC format.