code: def group_norm(
      input_,
      group,
      running_mean,
      running_var,
      weight=None,
      bias=None,
      use_input_stats=True,
      momentum=0.1,
      eps=1e-5,
  ):
      r"""Applies Group Normalization for channels in the same group in each data sample in a
      batch.
  
      See :class:`~torch.nn.GroupNorm2d`, for details.
      """
      if not use_input_stats and (
          running_mean is None or running_var is None
      ):
          raise ValueError(
              "Expected running_mean and running_var to be not None when use_input_stats=False"
          )
  
      b, c = input_.size(0), input_.size(1)
      if weight is not None:
          weight = weight.repeat(b)
      if bias is not None:
          bias = bias.repeat(b)
  
      def _group_norm(
          input_,
          group,
          running_mean=None,
          running_var=None,
          weight=None,
          bias=None,
          use_input_stats=None,
          momentum=None,
          eps=None,
      ):
          # Repeat stored stats and affine transform params if necessary
          if running_mean is not None:
              running_mean_orig = running_mean
              running_mean = running_mean_orig.repeat(b)
          if running_var is not None:
              running_var_orig = running_var
              running_var = running_var_orig.repeat(b)
  
          # norm_shape = [1, b * c / group, group]
          # print(norm_shape)
          # Apply group norm
          input_reshaped = input_.contiguous().view(
              1, int(b * c / group), group, *input_.size()[2:]
          )
  
          out = F.batch_norm(
              input_reshaped,
              running_mean,
              running_var,
              weight=weight,
              bias=bias,
              training=use_input_stats,
              momentum=momentum,
              eps=eps,
          )
  
          # Reshape back
          if running_mean is not None:
              running_mean_orig.copy_(
                  running_mean.view(b, int(c / group)).mean(
                      0, keepdim=False
                  )
              )
          if running_var is not None:
              running_var_orig.copy_(
                  running_var.view(b, int(c / group)).mean(
                      0, keepdim=False
                  )
              )
  
          return out.view(b, c, *input_.size()[2:])
  
      return _group_norm(
          input_,
          group,
          running_mean=running_mean,
          running_var=running_var,
          weight=weight,
          bias=bias,
          use_input_stats=use_input_stats,
          momentum=momentum,
          eps=eps,
      )
  
file_path: pywick/pywick/functions/group_norm.py
imports: import torch
  import torch.nn.functional
  from torch.nn.modules.batchnorm import _BatchNorm
label_desc: Use image node_id 1 for calling a global function with example usage: group_norm(input_, group, running_mean, running_var, weight, bias, use_input_stats, momentum, eps) and returns: _group_norm, out