code: def test_adv_subtensor():
      # Test the advancedsubtensor on gpu.
      shp = (2, 3, 4)
      shared = gpuarray_shared_constructor
      xval = np.arange(
          np.prod(shp), dtype=theano.config.floatX
      ).reshape(shp)
      idx1, idx2 = tensor.ivectors("idx1", "idx2")
      idxs = [idx1, None, slice(0, 2, 1), idx2, None]
      x = shared(xval, name="x")
      expr = x[idxs]
      f = theano.function([idx1, idx2], expr, mode=mode_with_gpu)
      assert (
          sum(
              [
                  isinstance(node.op, GpuAdvancedSubtensor)
                  for node in f.maker.fgraph.toposort()
              ]
          )
          == 1
      )
      idx1_val = [0, 1]
      idx2_val = [0, 1]
      rval = f(idx1_val, idx2_val)
      rep = xval[idx1_val, None, slice(0, 2, 1), idx2_val, None]
      assert np.allclose(rval, rep)
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import unittest
  import theano
  from theano import tensor
  from theano.compile import DeepCopyOp
  from theano.tensor.tests import test_subtensor, test_basic
  from theano.tests import unittest_tools
  from ..basic_ops import HostFromGpu, GpuFromHost, GpuContiguous
  from ..elemwise import GpuDimShuffle
  from ..subtensor import GpuIncSubtensor, GpuSubtensor, GpuAdvancedSubtensor1, GpuAdvancedSubtensor, GpuAdvancedBooleanSubtensor, GpuAdvancedIncSubtensor, GpuAdvancedIncSubtensor1, GpuAdvancedIncSubtensor1_dev20, GpuExtractDiag, GpuAllocDiag
  from ..type import gpuarray_shared_constructor
  from .config import mode_with_gpu, test_ctx_name
label_desc: Use image node_id 7 for calling a global function with example usage: test_adv_subtensor() without return types