code: def _test_specific_layer(inputs, axis, groups, center, scale):
      input_shape = inputs.shape
  
      # Get Output from Keras model
      layer = GroupNormalization(
          axis=axis, groups=groups, center=center, scale=scale
      )
      model = tf.keras.models.Sequential()
      model.add(layer)
      outputs = model.predict(inputs, steps=1)
      assert not np.isnan(outputs).any()
  
      is_instance_norm = False
      # Create shapes
      if groups == -1:
          groups = input_shape[axis]
      if (input_shape[axis] // groups) == 1:
          is_instance_norm = True
      np_inputs = inputs
      reshaped_dims = list(np_inputs.shape)
      if not is_instance_norm:
          reshaped_dims[axis] = reshaped_dims[axis] // groups
          reshaped_dims.insert(axis, groups)
          reshaped_inputs = np.reshape(np_inputs, tuple(reshaped_dims))
      else:
          reshaped_inputs = np_inputs
  
      group_reduction_axes = list(range(1, len(reshaped_dims)))
      if not is_instance_norm:
          axis = -2 if axis == -1 else axis - 1
      else:
          axis = -1 if axis == -1 else axis - 1
      group_reduction_axes.pop(axis)
  
      # Calculate mean and variance
      mean = np.mean(
          reshaped_inputs,
          axis=tuple(group_reduction_axes),
          keepdims=True,
      )
      variance = np.var(
          reshaped_inputs,
          axis=tuple(group_reduction_axes),
          keepdims=True,
      )
  
      # Get gamma and beta initalized by layer
      gamma, beta = layer._get_reshaped_weights(input_shape)
      if gamma is None:
          gamma = 1.0
      if beta is None:
          beta = 0.0
  
      # Get ouput from Numpy
      zeroed = reshaped_inputs - mean
      rsqrt = 1 / np.sqrt(variance + 1e-5)
      output_test = gamma * zeroed * rsqrt + beta
  
      # compare outputs
      output_test = tf.reshape(output_test, input_shape)
      np.testing.assert_almost_equal(
          tf.reduce_mean(output_test - outputs), 0, decimal=7
      )
  
imports: import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.layers.normalizations import FilterResponseNormalization
  from tensorflow_addons.layers.normalizations import GroupNormalization
  from tensorflow_addons.layers.normalizations import InstanceNormalization
label_desc: Use image node_id 9 for calling a global function with example usage: _test_specific_layer(inputs, axis, groups, center, scale) without return types