code: def test_batch_normalization_forward_backward(
      seed,
      axis,
      decay_rate,
      eps,
      output_stat,
      batch_stat,
      ctx,
      func_name,
      no_scale,
      no_bias,
      no_mean,
      no_variance,
  ):
      from nbla_test_utils import function_tester
  
      rng = np.random.RandomState(seed)
      inputs = list(create_inputs(rng, axis))
      axes = [axis]
  
      if not batch_stat and (no_mean or no_variance):
          # check prohibited condition for mean=None and variance=None
          vinputs = []
          for i in inputs:
              vinputs.append(nn.Variable(i.shape, True))
  
          vinputs = mask_vinputs(
              vinputs, no_scale, no_bias, no_mean, no_variance
          )
          with pytest.raises(ValueError):
              F.batch_normalization(
                  *vinputs,
                  axes=axes,
                  decay_rate=decay_rate,
                  eps=eps,
                  batch_stat=batch_stat,
                  output_stat=output_stat,
              )
          return
      else:
          inputs = mask_inputs(
              inputs, no_scale, no_bias, no_mean, no_variance
          )
          insert_identity = []
          if batch_stat:
              insert_identity = [True, True, True, False, False]
          function_tester(
              rng,
              F.batch_normalization,
              ref_batch_normalization,
              inputs,
              func_args=[
                  axes,
                  decay_rate,
                  eps,
                  batch_stat,
                  output_stat,
              ],
              backward=[True, True, True, False, False],
              ctx=ctx,
              func_name=func_name,
              dstep=1e-2,
              atol_b=1e-2,
              insert_identity=insert_identity,
          )
  
      # Check if running mean and var works.
      if no_mean and no_variance:
          return
  
      vinputs = []
      for i in inputs:
          vinputs.append(nn.Variable(i.shape, True))
          vinputs[-1].d = i
  
      vinputs = mask_vinputs(
          vinputs, no_scale, no_bias, no_mean, no_variance
      )
  
      for i in range(5):
          inputs[0] = rng.randn(*inputs[0].shape)
          vinputs[0].d[...] = inputs[0]
          ref_y = ref_batch_normalization(
              *(
                  inputs
                  + [axes, decay_rate, eps, batch_stat, output_stat]
              )
          )
          with nn.context_scope(ctx), nn.auto_forward():
              y = F.batch_normalization(
                  *(
                      vinputs
                      + [axes, decay_rate, eps, batch_stat, output_stat]
                  )
              )
          if not no_mean:
              assert_allclose(vinputs[3].d, inputs[3], atol=1e-7)
  
          if not no_variance:
              assert_allclose(vinputs[4].d, inputs[4])
  
      # Check if global stat mode works
      batch_stat = False
  
      if no_mean or no_variance:
          return
  
      if output_stat:
          return
      ref_y = ref_batch_normalization(
          *(inputs + [axes, decay_rate, eps, batch_stat, output_stat])
      )
      with nn.context_scope(ctx), nn.auto_forward():
          y = F.batch_normalization(
              *(
                  vinputs
                  + [axes, decay_rate, eps, batch_stat, output_stat]
              )
          )
      assert_allclose(ref_y, y.d, atol=1e-6)
  
file_path: nnabla/python/test/function/test_batch_normalization.py
imports: from six.moves import range
  import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nbla_test_utils import list_context
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 5 for calling a global function with example usage: test_batch_normalization_forward_backward(seed, axis, decay_rate, eps, output_stat, batch_stat, ctx, func_name, no_scale, no_bias, no_mean, no_variance) without return types