code: def test_grad_constant(self):
      # Test that the gradient handles Constants and consider_constant variables
      # consistently
  
      x = theano.tensor.scalar()
      y = theano.tensor.scalar()
      z_x = x + y
      z_one = one + y
      g_x = theano.tensor.grad(z_x, x, consider_constant=[x])
      g_one = theano.tensor.grad(z_one, one)
  
      f = theano.function([x, y], [g_x, g_one])
  
      g_x, g_one = f(1, 0.5)
  
      if not np.allclose(g_x, g_one):
          raise AssertionError(
              "Gradient using consider constant is "
              + str(g_x)
              + " but gradient with respect to the same Constant is "
              + str(g_one)
          )
  
imports: from __future__ import absolute_import, print_function, division
  from collections import OrderedDict
  import unittest
  import numpy
  from six.moves import xrange
  import theano
  from theano import gof, change_flags
  from theano.compat import izip
  from theano.tests import unittest_tools
  from theano import gradient
  from theano import config
  from theano.gof.null_type import NullType
  from theano.sandbox.rng_mrg import MRG_RandomStreams
label_desc: Use image node_id 16 for calling the test_grad obj's underlying member method code with example usage: obj.test_grad_constant() without return types