code: def test_use_gradient():
      def foo_grad(op, grad):
          return tf.constant(42), tf.constant(43)
  
      @use_gradient(foo_grad)
      def foo(x, y):
          return x + y
  
      with tf.Session().as_default() as sess:
          x = tf.constant(1.0)
          y = tf.constant(2.0)
          z = foo(x, y)
          grad_wrt_x = tf.gradients(z, x, [1.0])[0]
          grad_wrt_y = tf.gradients(z, y, [1.0])[0]
          assert grad_wrt_x.eval() == 42
          assert grad_wrt_y.eval() == 43
  
file_path: lucid/tests/misc/test_gradient_override.py
imports: import pytest
  import tensorflow
  from lucid.misc.gradient_override import use_gradient
  from lucid.misc.gradient_override import gradient_override_map
  from lucid.misc.redirected_relu_grad import redirected_relu_grad, redirected_relu6_grad
label_desc: Use image node_id 1 for calling a global function with example usage: test_use_gradient() and returns: tf,  tf, unknown