code: def ref_average_pooling_2d(
      x, kernel, stride, ignore_border, pad, including_pad
  ):
      y = []
      for xx in x.reshape((-1,) + x.shape[-3:]):
          if xx.ndim == 2:
              xx = xx[np.newaxis]
          y += [
              refs.pooling_2d(
                  xx,
                  "average",
                  kernel,
                  stride,
                  pad,
                  ignore_border,
                  including_pad,
              )[np.newaxis]
          ]
      y = np.vstack(y)
      if x.ndim == 2:
          y = np.squeeze(y, 1)
      return y.reshape(x.shape[:-3] + y.shape[1:])
  
file_path: nnabla/python/test/function/test_average_pooling.py
imports: import pytest
  import numpy
  import nnabla.functions
  import refs
  from nbla_test_utils import list_context
label_desc: Use image node_id 1 for calling a global function with example usage: ref_average_pooling_2d(x, kernel, stride, ignore_border, pad, including_pad) and returns: y