code: def test_gpueye():
      def check(dtype, N, M_=None, k=0):
          # Theano does not accept None as a tensor.
          # So we must use a real value.
          M = M_
          # Currently DebugMode does not support None as inputs even if this is
          # allowed.
          if M is None:
              M = N
          N_symb = T.iscalar()
          M_symb = T.iscalar()
          k_symb = T.iscalar()
          out = T.eye(N_symb, M_symb, k_symb, dtype=dtype) + np.array(
              1
          ).astype(dtype)
          f = theano.function(
              [N_symb, M_symb, k_symb], out, mode=mode_with_gpu
          )
  
          result = np.asarray(f(N, M, k)) - np.array(1).astype(dtype)
          assert np.allclose(result, np.eye(N, M_, k, dtype=dtype))
          assert result.dtype == np.dtype(dtype)
          assert any(
              [
                  isinstance(node.op, GpuEye)
                  for node in f.maker.fgraph.toposort()
              ]
          )
  
      for dtype in ["float32", "int32", "float16"]:
          yield check, dtype, 3
          # M != N, k = 0
          yield check, dtype, 3, 5
          yield check, dtype, 5, 3
          # N == M, k != 0
          yield check, dtype, 3, 3, 1
          yield check, dtype, 3, 3, -1
          # N < M, k != 0
          yield check, dtype, 3, 5, 1
          yield check, dtype, 3, 5, -1
          # N > M, k != 0
          yield check, dtype, 5, 3, 1
          yield check, dtype, 5, 3, -1
          # k > M, -k > N, k > M, k > N
          yield check, dtype, 5, 3, 3
          yield check, dtype, 3, 5, 3
          yield check, dtype, 5, 3, -3
          yield check, dtype, 3, 5, -3
          yield check, dtype, 5, 3, 6
          yield check, dtype, 3, 5, -6
  
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 13 for calling a global function with example usage: test_gpueye() without return types