code: def test_grad_clip():
      x = theano.tensor.scalar()
  
      z = theano.tensor.grad(gradient.grad_clip(x, -1, 1) ** 2, x)
      z2 = theano.tensor.grad(x**2, x)
  
      f = theano.function([x], outputs=[z, z2])
  
      if theano.config.mode != "FAST_COMPILE":
          topo = f.maker.fgraph.toposort()
          assert not any(
              [isinstance(node.op, gradient.GradClip) for node in topo]
          )
      out = f(2.0)
      assert np.allclose(out, (1, 4))
      assert not np.allclose(out[0], out[1])
  
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 8 for calling a global function with example usage: test_grad_clip() without return types