code: def test_batch_normalization(self):
      input_shape = [1, 3, 224, 224]
      output_shape = [1, 3, 224, 224]
      # Create inputs (ValueInfoProto)
      X = onnx.helper.make_tensor_value_info(
          "X", onnx.TensorProto.FLOAT, input_shape
      )
      scale = onnx.helper.make_tensor_value_info(
          "scale", onnx.TensorProto.FLOAT, input_shape[:2]
      )
      bias = onnx.helper.make_tensor_value_info(
          "bias", onnx.TensorProto.FLOAT, input_shape[:2]
      )
      mean = onnx.helper.make_tensor_value_info(
          "mean", onnx.TensorProto.FLOAT, input_shape[:2]
      )
      var = onnx.helper.make_tensor_value_info(
          "var", onnx.TensorProto.FLOAT, input_shape[:2]
      )
      # Create one output (ValueInfoProto)
      Y = onnx.helper.make_tensor_value_info(
          "Y", onnx.TensorProto.FLOAT, output_shape
      )
  
      scale_vals = np.random.random(input_shape[1]) * 10
      bias_vals = np.random.random(input_shape[1]) * 10
      mean_vals = np.random.random(input_shape[1]) * 10
      var_vals = np.random.random(input_shape[1]) * 10
      input_x = np.random.random(input_shape) * 10
      epsilon = float(1e-05)
      momentum = float(0.9)
  
      init_scale = onnx.helper.make_tensor(
          name="scale",
          data_type=onnx.TensorProto.FLOAT,
          dims=input_shape[:2],
          vals=scale_vals.tolist(),
      )
  
      init_bias = onnx.helper.make_tensor(
          name="bias",
          data_type=onnx.TensorProto.FLOAT,
          dims=input_shape[:2],
          vals=bias_vals.tolist(),
      )
  
      init_mean = onnx.helper.make_tensor(
          name="mean",
          data_type=onnx.TensorProto.FLOAT,
          dims=input_shape[:2],
          vals=mean_vals.tolist(),
      )
  
      init_var = onnx.helper.make_tensor(
          name="var",
          data_type=onnx.TensorProto.FLOAT,
          dims=input_shape[:2],
          vals=var_vals.tolist(),
      )
  
      # Create a node (NodeProto)
      batch_norm_node = onnx.helper.make_node(
          op_type="BatchNormalization",  # node name
          inputs=["X", "scale", "bias", "mean", "var"],  # inputs
          outputs=["Y"],  # outputs
          epsilon=epsilon,
          momentum=momentum,
      )
  
      # Create the graph (GraphProto)
      onnx_graph = onnx.helper.make_graph(
          nodes=[batch_norm_node],
          name="test-batch_norm",
          inputs=[X],
          outputs=[Y],
          initializer=[init_scale, init_bias, init_mean, init_var],
      )
  
      # Create the model (ModelProto)
      onnx_model = onnx.helper.make_model(
          onnx_graph, producer_name="ONNX"
      )
      onnx.checker.check_model(onnx_model)
  
      loaded_model = load_model_proto(onnx_model)
      bigdl_model = SpatialBatchNormalization(
          n_output=input_shape[1],
          eps=epsilon,
          momentum=momentum,
          init_weight=scale_vals,
          init_bias=bias_vals,
          init_grad_weight=None,
          init_grad_bias=None,
      )
      bigdl_model.set_running_mean(mean_vals)
      bigdl_model.set_running_std(var_vals)
  
      loaded_out = loaded_model.forward(input_x)
      expected_out = bigdl_model.forward(input_x)
  
      assert np.array_equal(loaded_out, expected_out)
  
imports: import onnx
  import pytest
  import numpy
  from bigdl.dllib.contrib.onnx.onnx_loader import load_model_proto
  from bigdl.dllib.nn.layer import CAddTable, JoinTable, ReLU
  from bigdl.dllib.nn.layer import SoftMax, SpatialAveragePooling, SpatialBatchNormalization
  from bigdl.dllib.nn.layer import SpatialConvolution, SpatialMaxPooling
  from bigdl.dllib.nn.layer import Unsqueeze
  from bigdl.dllib.nn.onnx.layer import Gemm, Reshape, Shape
label_desc: Use image node_id 1 for calling the TestBatchNormalization obj's underlying member method code with example usage: obj.test_batch_normalization() without return types