code: def add_gradients_summary(
      grads, name_prefix="", name_suffix="", collection_key=None
  ):
      """add_gradients_summary.
  
      Add histogram summary for given gradients.
  
      Arguments:
          grads: A list of `Tensor`. The gradients to summarize.
          name_prefix: `str`. A prefix to add to summary scope.
          name_suffix: `str`. A suffix to add to summary scope.
          collection_key: `str`. A collection to store the summaries.
  
      Returns:
          The list of created gradient summaries.
  
      """
  
      # Add histograms for gradients.
      summ = []
      for grad, var in grads:
          if grad is not None:
              summ_name = format_scope_name(
                  var.op.name, name_prefix, "Gradients/" + name_suffix
              )
              summ_exists = summary_exists(summ_name)
              if summ_exists is not None:
                  tf.add_to_collection(collection_key, summ_exists)
                  summ.append(summ_exists)
              else:
                  summ.append(
                      get_summary(
                          "histogram", summ_name, grad, collection_key
                      )
                  )
      return summ
  
file_path: tflearn/tflearn/summaries.py
imports: from __future__ import division, print_function, absolute_import
  import tensorflow.compat.v1
  from tensorflow.core.framework import summary_pb2
  from .utils import format_scope_name
label_desc: Use image node_id 4 for calling a global function with example usage: add_gradients_summary(grads, name_prefix, name_suffix, collection_key) and returns: summ