code: def GroupNorm(
      x, group, gamma_initializer=tf.constant_initializer(1.0)
  ):
      """
      https://arxiv.org/abs/1803.08494
      More code that reproduces the paper can be found at https://github.com/ppwwyyxx/GroupNorm-reproduce/.
      """
      shape = x.get_shape().as_list()
      ndims = len(shape)
      assert ndims == 4, shape
      chan = shape[1]
      assert chan % group == 0, chan
      group_size = chan // group
  
      orig_shape = tf.shape(x)
      h, w = orig_shape[2], orig_shape[3]
  
      x = tf.reshape(x, tf.stack([-1, group, group_size, h, w]))
  
      mean, var = tf.nn.moments(x, [2, 3, 4], keep_dims=True)
  
      new_shape = [1, group, group_size, 1, 1]
  
      beta = tf.get_variable(
          "beta", [chan], initializer=tf.constant_initializer()
      )
      beta = tf.reshape(beta, new_shape)
  
      gamma = tf.get_variable(
          "gamma", [chan], initializer=gamma_initializer
      )
      gamma = tf.reshape(gamma, new_shape)
  
      out = tf.nn.batch_normalization(
          x, mean, var, beta, gamma, 1e-5, name="output"
      )
      return tf.reshape(out, orig_shape, name="output")
  
file_path: tensorpack/examples/ImageNetModels/vgg16.py
imports: import argparse
  import os
  from tensorpack import tfv1
  from tensorpack import *
  from tensorpack.tfutils import argscope
  from tensorpack.tfutils.summary import *
  from tensorpack.utils.gpu import get_num_gpu
  from imagenet_utils import ImageNetModel, fbresnet_augmentor, get_imagenet_dataflow
label_desc: Use image node_id 1 for calling a global function with example usage: GroupNorm(x, group, gamma_initializer) and returns: tf