code: def ref_layer_normalization(
      x, beta, gamma, batch_axis, eps, output_stat
  ):
      batch_axis = _force_list(batch_axis)
  
      batch_axis = [b + x.ndim * (b < 0) for b in batch_axis]
      axes = tuple(_get_axes_excluding(len(x.shape), batch_axis))
  
      x_mean = x.mean(axis=axes, keepdims=True)
      x_var = x.var(axis=axes, keepdims=True)
  
      norm = (x - x_mean) / (x_var + eps) ** 0.5
  
      if gamma is not None:
          norm *= gamma
  
      if beta is not None:
          norm += beta
  
      if output_stat:
          return norm, x_mean, x_var
  
      return norm
  
file_path: nnabla/python/test/function/test_layer_normalization.py
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nbla_test_utils import list_context
  from nnabla.normalization_functions import _force_list, _get_axes_excluding
label_desc: Use image node_id 1 for calling a global function with example usage: ref_layer_normalization(x, beta, gamma, batch_axis, eps, output_stat) and returns: norm, norm,  x_mean,  x_var