code: def test_downsample(self):
      rng = np.random.RandomState(utt.fetch_seed())
      # ws, shp
      examples = (
          ((2,), (16,)),
          (
              (2,),
              (
                  4,
                  16,
              ),
          ),
          (
              (2,),
              (
                  4,
                  2,
                  16,
              ),
          ),
          ((1, 1), (4, 2, 16, 16)),
          ((2, 2), (4, 2, 16, 16)),
          ((3, 3), (4, 2, 16, 16)),
          ((3, 2), (4, 2, 16, 16)),
          ((3, 2, 2), (3, 2, 16, 16, 16)),
          ((2, 3, 2), (3, 2, 16, 16, 16)),
          ((2, 2, 3), (3, 2, 16, 16, 16)),
          ((2, 2, 3, 2), (3, 2, 6, 6, 6, 5)),
      )
  
      for example, ignore_border in itertools.product(
          examples, [True, False]
      ):
          (ws, shp) = example
          vx = rng.rand(*shp)
          vex = rng.rand(*shp)
  
          x = theano.shared(vx)
          ex = theano.shared(vex)
  
          maxpool_op = Pool(ignore_border, ndim=len(ws))
          a_pooled = maxpool_op(x, ws).flatten()
          yv = tensor.Rop(a_pooled, x, ex)
          mode = None
          if theano.config.mode == "FAST_COMPILE":
              mode = "FAST_RUN"
          rop_f = function([], yv, on_unused_input="ignore", mode=mode)
          sy, _ = theano.scan(
              lambda i, y, x, v: (tensor.grad(y[i], x) * v).sum(),
              sequences=tensor.arange(a_pooled.shape[0]),
              non_sequences=[a_pooled, x, ex],
              mode=mode,
          )
          scan_f = function([], sy, on_unused_input="ignore", mode=mode)
          v1 = rop_f()
          v2 = scan_f()
          assert np.allclose(v1, v2), "Rop mismatch: %s %s" % (v1, v2)
  
imports: from __future__ import absolute_import, print_function, division
  import unittest
  from theano.tests import unittest_tools
  from theano import function
  import theano
  from theano import tensor
  import itertools
  import numpy
  from theano.gof import Op, Apply
  from theano.gradient import grad_undefined
  from theano.tests.unittest_tools import SkipTest
  from theano.tensor.signal.pool import Pool
  from theano.tensor.nnet import conv, conv2d
label_desc: Use image node_id 13 for calling the test_RopLop obj's underlying member method code with example usage: obj.test_downsample() without return types