class_docstr: This collector has a list of all gradients, collected when
  constructing the tf graph. The gradient from multiple GPUs
  will be averaged, and the averaged op is added to graph
  by application driver
docstr: this function returns averaged gradient over devices
  used by application driver
  :return: averaged gradients over devices
docstr_tok: ["this","function","returns","averaged","gradient","over","devices","used","by","application","driver",":","return",":","averaged","gradients","over","devices"]
code: def gradients(self):
      """
      this function returns averaged gradient over devices
      used by application driver
      :return: averaged gradients over devices
      """
      assert (
          self._gradients
      ), "Please add gradients to collector when constructing the graph"
      return util.average_multi_opt_gradients(self._gradients)
  
imports: from __future__ import absolute_import, print_function
  import tensorflow
  from tensorflow.contrib.framework import list_variables
  from niftynet.io.misc_io import image3_axial, image3_coronal, image3_sagittal, resolve_checkpoint
  from niftynet.utilities import util_common
  from niftynet.utilities.restore_initializer import restore_initializer
label_desc: Use image node_id 3 for calling the GradientsCollector obj's underlying member method code with example usage: obj.gradients() and returns: util