code: def test_average_pooling2d(self):
      x = shaparange((2, 3, 10, 30))
      y = objax.functional.average_pool_2d(x, size=5)
      z = x.reshape((2, 3, 2, 5, 6, 5)).mean((-3, -1))
      self.assertEqual(y.tolist(), z.tolist())
      y = objax.functional.average_pool_2d(x, size=5, strides=1)
      z = np.zeros((2, 3, 6, 26), dtype=float)
      for i in range(6):
          for j in range(26):
              z[:, :, i, j] = x[:, :, i : i + 5, j : j + 5].mean(
                  (-2, -1)
              )
      self.assertEqual(y.tolist(), z.tolist())
      y = objax.functional.average_pool_2d(x, size=(2, 3))
      z = x.reshape((2, 3, 5, 2, 10, 3)).mean((-3, -1))
      self.assertEqual(y.tolist(), z.tolist())
  
file_path: objax/tests/functional_pooling.py
imports: import unittest
  import jax.numpy
  import numpy
  import objax
label_desc: Use image node_id 1 for calling the TestPooling obj's underlying member method code with example usage: obj.test_average_pooling2d() without return types