code: def test_grad_inrange():
      for bound_definition in [(True, True), (False, False)]:
          # Instantiate op, and then take the gradient
          op = InRange(*bound_definition)
          x = theano.tensor.fscalar("x")
          low = theano.tensor.fscalar("low")
          high = theano.tensor.fscalar("high")
          out = op(x, low, high)
          gx, glow, ghigh = theano.tensor.grad(out, [x, low, high])
  
          # We look if the gradient are equal to zero
          # if x is lower than the lower bound,
          # equal to the lower bound, between lower and higher bound,
          # equal to the higher bound and higher than the higher
          # bound.
          # Mathematically we should have an infinite gradient when
          # x is equal to the lower or higher bound but in that case
          # Theano defines the gradient to be zero for stability.
          f = theano.function([x, low, high], [gx, glow, ghigh])
          utt.assert_allclose(f(0, 1, 5), [0, 0, 0])
          utt.assert_allclose(f(1, 1, 5), [0, 0, 0])
          utt.assert_allclose(f(2, 1, 5), [0, 0, 0])
          utt.assert_allclose(f(5, 1, 5), [0, 0, 0])
          utt.assert_allclose(f(7, 1, 5), [0, 0, 0])
  
imports: from __future__ import absolute_import, print_function, division
  import unittest
  import numpy
  import theano
  from theano.gof import FunctionGraph
  from theano import gof
  from theano.tests import unittest_tools
  from theano.scalar.basic import floats, float16, float32, float64, ints, int8, int32, complex64, uint8, ComplexError, IntDiv, TrueDiv, Composite, add, div_proxy, and_, eq, neq, invert, mul, Scalar, InRange, cast, constant, switch
  from theano.scalar.basic import true_div, inv, log, log2, log10, log1p, exp, exp2, expm1, sqrt, deg2rad, rad2deg, cos, arccos, sin, arcsin, tan, arctan, arctan2, cosh, arccosh, sinh, arcsinh, tanh, arctanh
label_desc: Use image node_id 6 for calling a global function with example usage: test_grad_inrange() without return types