code: def normalize_gradient(grad_scales=None):
      if grad_scales is not None:
          grad_scales = np.float32(grad_scales)
  
      op_name = "NormalizeGrad_" + str(uuid.uuid4())
  
      @tf.RegisterGradient(op_name)
      def _NormalizeGrad(op, grad):
          grad_norm = tf.sqrt(
              tf.reduce_sum(grad**2, [1, 2, 3], keepdims=True)
          )
          if grad_scales is not None:
              grad *= grad_scales[:, None, None, None]
          return grad / grad_norm
  
      def inner(x):
          with x.graph.gradient_override_map({"Identity": op_name}):
              x = tf.identity(x)
          return x
  
      return inner
  
file_path: lucid/lucid/optvis/transform.py
imports: import tensorflow
  import numpy
  import uuid
  from lucid.optvis import param
label_desc: Use image node_id 5 for calling a global function with example usage: normalize_gradient(grad_scales) and returns: inner, unknown, x