code: def test_infer_shape(self):
      image = tensor.dtensor4()
      maxout = tensor.dtensor4()
      gz = tensor.dtensor4()
      rng = np.random.RandomState(utt.fetch_seed())
      maxpoolshps = ((1, 1), (2, 2), (3, 3), (2, 3), (3, 2))
  
      image_val = rng.rand(4, 6, 7, 9)
      out_shapes = [
          [
              [[4, 6, 7, 9], [4, 6, 7, 9]],
              [[4, 6, 3, 4], [4, 6, 4, 5]],
              [[4, 6, 2, 3], [4, 6, 3, 3]],
              [[4, 6, 3, 3], [4, 6, 4, 3]],
              [[4, 6, 2, 4], [4, 6, 3, 5]],
          ],
          [
              [None, None],
              [[4, 6, 4, 5], None],
              [[4, 6, 3, 3], None],
              [[4, 6, 4, 3], None],
              [[4, 6, 3, 5], None],
          ],
          [
              [None, None],
              [None, None],
              [[4, 6, 3, 4], None],
              [[4, 6, 4, 4], None],
              [None, None],
          ],
      ]
  
      for i, maxpoolshp in enumerate(maxpoolshps):
          for j, ignore_border in enumerate([True, False]):
              for k, pad in enumerate([(0, 0), (1, 1), (1, 2)]):
                  if out_shapes[k][i][j] is None:
                      continue
                  # checking shapes generated by Pool
                  self._compile_and_check(
                      [image],
                      [
                          Pool(ignore_border=ignore_border)(
                              image, maxpoolshp, pad=pad
                          )
                      ],
                      [image_val],
                      Pool,
                  )
  
                  # checking shapes generated by MaxPoolGrad
                  maxout_val = rng.rand(*out_shapes[k][i][j])
                  gz_val = rng.rand(*out_shapes[k][i][j])
                  self._compile_and_check(
                      [image, maxout, gz],
                      [
                          MaxPoolGrad(ignore_border=ignore_border)(
                              image, maxout, gz, maxpoolshp, pad=pad
                          )
                      ],
                      [image_val, maxout_val, gz_val],
                      MaxPoolGrad,
                      warn=False,
                  )
      # checking with broadcastable input
      image = tensor.tensor(
          dtype="float64", broadcastable=(False, False, True, True)
      )
      image_val = rng.rand(4, 6, 1, 1)
      self._compile_and_check(
          [image],
          [Pool(ignore_border=True)(image, (2, 2), pad=(0, 0))],
          [image_val],
          Pool,
      )
  
imports: from __future__ import absolute_import, print_function, division
  from nose.plugins.skip import SkipTest
  from parameterized import parameterized
  from itertools import product
  import os
  import unittest
  from six import reraise
  from six.moves import cPickle
  import six.moves.builtins
  import sys
  import numpy
  import theano
  import theano.tensor
  from theano.tests import unittest_tools
  from theano.tensor.signal.pool import Pool, pool_2d, pool_3d, MaxPoolGrad, AveragePoolGrad, max_pool_2d_same_size, DownsampleFactorMaxGradGrad
  from theano import function
label_desc: Use image node_id 29 for calling the TestDownsampleFactorMax obj's underlying member method code with example usage: obj.test_infer_shape() without return types