code: def _runtests(
      self, x_shape, is_training, gradient_test=False, cpu_only=False
  ):
      if len(x_shape) == 4:
          data_format_list = ["NHWC", "NCHW"]
      else:
          data_format_list = ["NCDHW", "NDHWC"]
      use_gpu_vals = [False]
      if test.is_gpu_available() and not cpu_only:
          use_gpu_vals += [True]
      factors = [1.0, 0.6]
      for dtype in [
          np.float16,
          np.float32,
          dtypes.bfloat16.as_numpy_dtype,
      ]:
          for use_gpu in use_gpu_vals:
              for data_format in data_format_list:
                  if data_format == "NHWC" or data_format == "NDHWC":
                      scale_shape = x_shape[-1:]
                  else:
                      scale_shape = x_shape[1:2]
                  for exponential_avg_factor in factors:
                      if gradient_test:
                          self._test_gradient(
                              x_shape,
                              dtype,
                              scale_shape,
                              np.float32,
                              use_gpu=use_gpu,
                              data_format=data_format,
                              is_training=is_training,
                              exponential_avg_factor=exponential_avg_factor,
                          )
                      else:
                          if is_training:
                              self._test_training(
                                  x_shape,
                                  dtype,
                                  scale_shape,
                                  np.float32,
                                  use_gpu=use_gpu,
                                  data_format=data_format,
                                  exponential_avg_factor=exponential_avg_factor,
                              )
                          else:
                              self._test_inference(
                                  x_shape,
                                  dtype,
                                  scale_shape,
                                  np.float32,
                                  use_gpu=use_gpu,
                                  data_format=data_format,
                                  exponential_avg_factor=exponential_avg_factor,
                              )
  
imports: import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_fused_batch_norm_grad
  from tensorflow.python.ops import nn_impl
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 10 for calling the BatchNormalizationTest obj's underlying member method code with example usage: obj._runtests(x_shape, is_training, gradient_test, cpu_only) without return types