code: def convert_BatchNormalization(
      func, opset_version, input_names, output_names, context
  ):
      is_fixed_bn = len(func.inputs) > 3
  
      # NOTE: even if `use_beta=False` or `use_gamma=False`, beta or gamma
      # are set in inputs by RetainHook,
      beta_param = func.inputs[2].get_variable_or_none()
      gamma_param = func.inputs[1].get_variable_or_none()
      namedlink = context.get_link(beta_param) or context.get_link(
          gamma_param
      )
  
      if namedlink is not None:
          prefix, link = namedlink
          if is_fixed_bn:
              mean = link.avg_mean
              var = link.avg_var
          else:
              # on train mode, avg_mean would be updated, so make them from x
              x = func.inputs[0].get_variable().array
              mean = x.mean(axis=func.axis)
              var = x.var(axis=func.axis)
      else:
          prefix = None
          if is_fixed_bn:
              mean = func.inputs[3].get_variable().array
              var = func.inputs[4].get_variable().array
          else:
              x = func.inputs[0].get_variable().array
              mean = x.mean(axis=func.axis)
              var = x.var(axis=func.axis)
  
      def add_param(v, suffix):
          if prefix is None:
              return context.add_param(v, suffix)
          else:
              return context.add_param(
                  v,
                  "{}_{}".format(prefix, suffix),
                  use_original_name=True,
              )
  
      if is_fixed_bn:
          if (
              context.implicit_inputs.pop(input_names[3], None)
              is not None
          ):
              mean_name = add_param(mean, "avg_mean")
              input_names[3] = mean_name
          if (
              context.implicit_inputs.pop(input_names[4], None)
              is not None
          ):
              var_name = add_param(var, "avg_var")
              input_names[4] = var_name
      else:
          maen_name = add_param(mean, "avg_mean")
          var_name = add_param(var, "avg_var")
          input_names.extend([maen_name, var_name])
  
      momentum = getattr(func, "decay", 0.0)
  
      # TODO(disktnk): On definition of ONNX's BatchNormalization operator,
      # outputs one required output and four optional outputs. This converter
      # must make 5 values for output and return them.
  
      if opset_version == 1:
          return (
              onnx_helper.make_node(
                  "BatchNormalization",
                  input_names,
                  output_names,
                  epsilon=func.eps,
                  momentum=momentum,
                  is_test=not chainer.config.train,
                  consumed_inputs=[False, False, False, True, True],
              ),
          )
      elif opset_version == 6:
          return (
              onnx_helper.make_node(
                  "BatchNormalization",
                  input_names,
                  output_names,
                  epsilon=func.eps,
                  momentum=momentum,
                  is_test=not chainer.config.train,
              ),
          )
      elif opset_version == 7:
          return (
              onnx_helper.make_node(
                  "BatchNormalization",
                  input_names,
                  output_names,
                  epsilon=func.eps,
                  momentum=momentum,
              ),
          )
  
file_path: chainer/onnx_chainer/functions/normalization.py
imports: import sys
  import chainer
  import numpy
  from onnx_chainer.functions.array import get_slice_node
  from onnx_chainer.functions.opset_version import support
  from onnx_chainer import onnx_helper
label_desc: Use image node_id 1 for calling a global function with example usage: convert_BatchNormalization(func, opset_version, input_names, output_names, context) and returns: onnx_helper, context, context, onnx_helper, onnx_helper