code: def test_gradient_override_relu6_directionality(
      nonl_name, nonl, nonl_grad_override, examples
  ):
      for incoming_grad, input, grad in examples:
          with tf.Session().as_default() as sess:
              global_step = tf.train.get_or_create_global_step()
              init_global_step = tf.variables_initializer([global_step])
              init_global_step.run()
  
              batched_shape = [1, 1]
              incoming_grad_t = tf.constant(
                  incoming_grad, shape=batched_shape
              )
              input_t = tf.constant(input, shape=batched_shape)
              with gradient_override_map(
                  {nonl_name: nonl_grad_override}
              ):
                  nonl_t = nonl(input_t)
                  grad_wrt_input = tf.gradients(
                      nonl_t, input_t, [incoming_grad_t]
                  )[0]
              assert (grad_wrt_input.eval() == grad).all()
  
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 3 for calling a global function with example usage: test_gradient_override_relu6_directionality(nonl_name, nonl, nonl_grad_override, examples) without return types