code: def _group_normalization_v1(
      x,
      beta,
      gamma,
      num_groups,
      channel_axis=1,
      batch_axis=0,
      eps=1e-05,
      output_stat=False,
  ):
      r"""
      Applies Group Normalization over an input tensor, which is defined as:
  
      .. math::
        \begin{eqnarray}
          \mu^g &=& \frac{1}{H} \sum_{i=1}^{H} x_i^g \\
          \sigma^g &=& \sqrt{\frac{1}{H} \sum_{i=1}^{H} \left(x_i^g - \mu^g\right)^2 + \epsilon} \\
          y &=& \frac{x - \mu^g}{\sigma^g} \gamma + \beta
        \end{eqnarray}
  
      where :math:`x` and :math:`y` are input and output variable,
      :math:`\mu^g` and :math:`\sigma^g` are the mean and std of each group which contains `num_channels / num_groups` channels,
      and :math:`\gamma` and :math:`\beta` are adaptive gains and biases.
  
      The input channels, specified by :attr:`channel_axis`, are separated into :attr:`num_groups` groups,
      and the mean and std are calculated over the each group.
      For example, if the input shape is [B, C, H, W] (= channel_axis=1, batch_axis=0),
      an input variable is once reshaped to [B, num_groups, C / num_groups, H, W]
      and standardize by its mean and std whose shapes are [B, num_groups, 1, 1, 1].
      Finally, an output variable is reshaped again to the original input shape (= [B, C, H, W] in the case above).
  
      References:
  
          * `Yuxin Wu, Kaiming He, Group Normalization.
            <https://arxiv.org/abs/1803.08494>`_
  
      Args:
          x (Variable): An input variable.
          beta (Variable or None): An Adaptive biases. If None, the bias term is omitted.
          gamma (Variable or None): An Adaptive gains. If None, the scale term is omitted.
          num_groups (int): A number of groups. The channel dim of 'x' must be integer multiple of `num_groups`.
          channel_axis (int): Channel axis.
          batch_axis (int or repeated int): Batch axes.
          eps (float): Tiny value to avoid zero division by std.
          output_stat(bool): If true, the batch statistics of mean and variance.
  
      Returns:
          * :obj:`~nnabla.Variable`: Normalized output variable.
          * :obj:`~nnabla.Variable`: Mean (if ``output_stat=True`)
          * :obj:`~nnabla.Variable`: Std (if ``output_stat=True`)
      """
      _check_axis(len(x.shape), channel_axis)
  
      cdim = x.shape[channel_axis]
  
      if cdim % num_groups > 0:
          raise ValueError(
              "Channel dim ({}) must be integer multiple of num_groups ({}).".format(
                  cdim, num_groups
              )
          )
  
      shape = x.shape[:channel_axis] + (
          num_groups,
          int(cdim / num_groups),
      )
      if channel_axis < len(x.shape) - 1:
          shape += x.shape[channel_axis + 1 :]
  
      # create dummy adaptive constants and pass these to BN.
      # GN normalizes input along group axis but applies adaptive rescaling along the original channel axis,
      # so we have to apply adaptive scaling after reshaping the output from batch normalization.
      # (Currently bn only accepts the case when reduction shape and adaptive parameter shape are the same.)
  
      out = instance_normalization(
          x.reshape(shape),
          beta=None,
          gamma=None,
          channel_axis=channel_axis,
          batch_axis=batch_axis,
          eps=eps,
          output_stat=output_stat,
      )
  
      if not output_stat:
          return _apply_affine(
              out.reshape(x.shape), scale=gamma, bias=beta
          )
  
      y, mean, var = out
      return (
          _apply_affine(y.reshape(x.shape), scale=gamma, bias=beta),
          mean,
          var,
      )
  
imports: from __future__ import absolute_import
  from .function_bases import *
  from six.moves import reduce
  import numpy
  import nnabla
label_desc: Use image node_id 19 for calling a global function with example usage: _group_normalization_v1(x, beta, gamma, num_groups, channel_axis, batch_axis, eps, output_stat) and returns: _apply_affine,  mean,  var, _apply_affine