code: def average_pool(inputs, prev_modules, attrs, outputs):
      # extract attributes
      auto_pad = attrs.get("auto_pad", "NOTSET")
      ceil_mode = True if attrs.get("ceil_mode", 0) == 1 else False
      count_include_pad = (
          True if attrs.get("count_include_pad", 0) == 1 else False
      )
      kernel_width, kernel_height = map(
          int, attrs.get("kernel_shape", (1, 1))[:2]
      )
      stride_width, stride_height = map(
          int, attrs.get("strides", (1, 1))[:2]
      )
      padding_width, padding_height = map(
          int, attrs.get("pads", (0, 0))[:2]
      )
      # extract inputs
      _, data_tensor_shape = inputs[0]
      # calc output tensor shape
      input_height, input_width = data_tensor_shape[-2:]
      output_height = calc_output_shape(
          input_height,
          kernel_height,
          padding=padding_height,
          stride=stride_height,
          ceil_mode=ceil_mode,
      )
      output_width = calc_output_shape(
          input_width,
          kernel_width,
          padding=padding_width,
          stride=stride_width,
          ceil_mode=ceil_mode,
      )
      out_tensor_shape = list(data_tensor_shape)
      out_tensor_shape[-2] = output_height
      out_tensor_shape[-1] = output_width
      out_tensor_shape = tuple(out_tensor_shape)
      # create module node
      module = SpatialAveragePooling(
          kw=kernel_width,
          kh=kernel_height,
          dw=stride_width,
          dh=stride_height,
          pad_w=padding_width,
          pad_h=padding_height,
          ceil_mode=ceil_mode,
          count_include_pad=count_include_pad,
      )(prev_modules)
      return module, [out_tensor_shape]
  
file_path: BigDL/python/dllib/src/bigdl/dllib/contrib/onnx/ops_converter.py
imports: from bigdl.dllib.nn.layer import SpatialAveragePooling, SpatialBatchNormalization
  from bigdl.dllib.nn.layer import SpatialConvolution, SpatialMaxPooling, JoinTable
  from bigdl.dllib.nn.layer import ReLU, SoftMax, CAddTable, Unsqueeze
  from bigdl.dllib.nn.onnx.layer import Constant, Gather, Gemm, Shape, Reshape
  from .converter_utils import *
label_desc: Use image node_id 1 for calling a global function with example usage: average_pool(inputs, prev_modules, attrs, outputs) and returns: module,  list