code: def makeTester(
      name,
      op,
      gpu_op,
      cases,
      checks=None,
      mode_gpu=mode_with_gpu,
      mode_nogpu=mode_without_gpu,
      skip=False,
      eps=1e-10,
  ):
      if checks is None:
          checks = {}
  
      _op = op
      _gpu_op = gpu_op
      _cases = cases
      _skip = skip
      _checks = checks
  
      class Checker(unittest.TestCase, utt.TestOptimizationMixin):
          op = staticmethod(_op)
          gpu_op = staticmethod(_gpu_op)
          cases = _cases
          skip = _skip
          checks = _checks
  
          def setUp(self):
              eval(
                  self.__class__.__module__
                  + "."
                  + self.__class__.__name__
              )
  
          def test_all(self):
              if skip:
                  from nose.plugins.skip import SkipTest
  
                  raise SkipTest(skip)
  
              for testname, inputs in iteritems(cases):
                  for _ in range(len(inputs)):
                      if type(inputs[_]) is float:
                          inputs[_] = np.asarray(
                              inputs[_], dtype=theano.config.floatX
                          )
                  self.run_case(testname, inputs)
  
          def run_case(self, testname, inputs):
              inputs_ref = [theano.shared(inp) for inp in inputs]
              inputs_tst = [theano.shared(inp) for inp in inputs]
  
              try:
                  node_ref = safe_make_node(self.op, *inputs_ref)
                  node_tst = safe_make_node(self.op, *inputs_tst)
              except Exception as exc:
                  err_msg = (
                      "Test %s::%s: Error occurred while making "
                      "a node with inputs %s"
                  ) % (self.gpu_op, testname, inputs)
                  exc.args += (err_msg,)
                  raise
  
              try:
                  f_ref = inplace_func(
                      [], node_ref.outputs, mode=mode_nogpu
                  )
                  f_tst = inplace_func(
                      [], node_tst.outputs, mode=mode_gpu
                  )
              except Exception as exc:
                  err_msg = (
                      "Test %s::%s: Error occurred while trying to "
                      "make a Function"
                  ) % (self.gpu_op, testname)
                  exc.args += (err_msg,)
                  raise
  
              self.assertFunctionContains1(f_tst, self.gpu_op)
  
              ref_e = None
              try:
                  expecteds = f_ref()
              except Exception as exc:
                  ref_e = exc
  
              try:
                  variables = f_tst()
              except Exception as exc:
                  if ref_e is None:
                      err_msg = (
                          "Test %s::%s: exception when calling the "
                          "Function"
                      ) % (self.gpu_op, testname)
                      exc.args += (err_msg,)
                      raise
                  else:
                      # if we raised an exception of the same type we're good.
                      if isinstance(exc, type(ref_e)):
                          return
                      else:
                          err_msg = (
                              "Test %s::%s: exception raised during test "
                              "call was not the same as the reference "
                              "call (got: %s, expected %s)"
                              % (
                                  self.gpu_op,
                                  testname,
                                  type(exc),
                                  type(ref_e),
                              )
                          )
                          exc.args += (err_msg,)
                          raise
  
              for i, (variable, expected) in enumerate(
                  izip(variables, expecteds)
              ):
                  if (
                      variable.dtype != expected.dtype
                      or variable.shape != expected.shape
                      or not TensorType.values_eq_approx(
                          variable, expected
                      )
                  ):
                      self.fail(
                          (
                              "Test %s::%s: Output %s gave the wrong "
                              "value. With inputs %s, expected %s "
                              "(dtype %s), got %s (dtype %s)."
                              % (
                                  self.op,
                                  testname,
                                  i,
                                  inputs,
                                  expected,
                                  expected.dtype,
                                  variable,
                                  variable.dtype,
                              )
                          )
                      )
  
              for description, check in iteritems(self.checks):
                  if not check(inputs, variables):
                      self.fail(
                          (
                              "Test %s::%s: Failed check: %s "
                              "(inputs were %s, ouputs were %s)"
                          )
                          % (
                              self.op,
                              testname,
                              description,
                              inputs,
                              variables,
                          )
                      )
  
      Checker.__name__ = name
      if hasattr(Checker, "__qualname__"):
          Checker.__qualname__ = name
      return Checker
  
imports: from __future__ import absolute_import, print_function, division
  import unittest
  from theano.compat import izip
  from six import iteritems
  import numpy
  import theano
  import theano.tensor
  from theano.tensor import TensorType
  from theano.tensor.basic import alloc
  from theano.tensor.tests import test_basic
  from theano.tensor.tests.test_basic import rand, safe_make_node
  from theano.tests import unittest_tools
  from ..type import GpuArrayType, get_context, gpuarray_shared_constructor
  from ..basic_ops import host_from_gpu, HostFromGpu, GpuFromHost, GpuReshape, GpuToGpu, GpuAlloc, GpuAllocEmpty, GpuContiguous, gpu_join, GpuJoin, GpuSplit, GpuEye, GpuTri, gpu_contiguous
  from ..elemwise import GpuDimShuffle, GpuElemwise
  from ..subtensor import GpuSubtensor
  from .config import mode_with_gpu, mode_without_gpu, test_ctx_name
  from pygpu import gpuarray
label_desc: Use image node_id 4 for calling a global function with example usage: makeTester(name, op, gpu_op, cases, checks, mode_gpu, mode_nogpu, skip, eps) and returns: Checker