code: def test_pooling2d_padding(self):
      x = shaparange((2, 3, 10, 30))
      y = objax.functional.average_pool_2d(x, size=5, padding=(2, 3))
      z = (
          pad(x, ((0, 0), (0, 0), (2, 3), (2, 3)))
          .reshape((2, 3, 3, 5, 7, 5))
          .mean((-3, -1))
      )
      self.assertEqual(y.tolist(), z.tolist())
      y = objax.functional.max_pool_2d(x, size=5, padding=(2, 3))
      z = (
          pad(x, ((0, 0), (0, 0), (2, 3), (2, 3)))
          .reshape((2, 3, 3, 5, 7, 5))
          .max((-3, -1))
      )
      self.assertEqual(y.tolist(), z.tolist())
      y = objax.functional.average_pool_2d(
          x, size=5, padding=((2, 3), (3, 2))
      )
      z = (
          pad(x, ((0, 0), (0, 0), (2, 3), (3, 2)))
          .reshape((2, 3, 3, 5, 7, 5))
          .mean((-3, -1))
      )
      self.assertEqual(y.tolist(), z.tolist())
      y = objax.functional.max_pool_2d(
          x, size=5, padding=((2, 3), (3, 2))
      )
      z = (
          pad(x, ((0, 0), (0, 0), (2, 3), (3, 2)))
          .reshape((2, 3, 3, 5, 7, 5))
          .max((-3, -1))
      )
      self.assertEqual(y.tolist(), z.tolist())
      y = objax.functional.average_pool_2d(x, size=2, padding=1)
      z = (
          pad(x, ((0, 0), (0, 0), (1, 1), (1, 1)))
          .reshape((2, 3, 6, 2, 16, 2))
          .mean((-3, -1))
      )
      self.assertEqual(y.tolist(), z.tolist())
      y = objax.functional.max_pool_2d(x, size=2, padding=1)
      z = (
          pad(x, ((0, 0), (0, 0), (1, 1), (1, 1)))
          .reshape((2, 3, 6, 2, 16, 2))
          .max((-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 3 for calling the TestPooling obj's underlying member method code with example usage: obj.test_pooling2d_padding() without return types