code: def test_incsub_f16():
      shp = (3, 3)
      shared = gpuarray_shared_constructor
      xval = np.arange(np.prod(shp), dtype="float16").reshape(shp) + 1
      yval = np.empty((2,) + shp[1:], dtype="float16")
      yval[:] = 2
      x = shared(xval, name="x")
      y = tensor.tensor(
          dtype="float16", broadcastable=(False,) * len(shp), name="y"
      )
      expr = tensor.advanced_inc_subtensor1(x, y, [0, 2])
      f = theano.function([y], expr, mode=mode_with_gpu)
      assert (
          sum(
              [
                  isinstance(node.op, GpuAdvancedIncSubtensor1)
                  for node in f.maker.fgraph.toposort()
              ]
          )
          == 1
      )
      rval = f(yval)
      rep = xval.copy()
      np.add.at(rep, [[0, 2]], yval)
      assert np.allclose(rval, rep)
  
      expr = tensor.inc_subtensor(x[1:], y)
      f = theano.function([y], expr, mode=mode_with_gpu)
      assert (
          sum(
              [
                  isinstance(node.op, GpuIncSubtensor)
                  for node in f.maker.fgraph.toposort()
              ]
          )
          == 1
      )
      rval = f(yval)
      rep = xval.copy()
      rep[1:] += yval
      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 5 for calling a global function with example usage: test_incsub_f16() without return types