class_docstr: An optimizer that wraps another tf.Optimizer, using an allreduce to
  combine gradient values before applying gradients to model weights.
class_docstr_tok: ["An","optimizer","that","wraps","another","tf.Optimizer",",","using","an","allreduce","to","combine","gradient","values","before","applying","gradients","to","model","weights","."]
docstr: Compute gradients of all trainable variables.
  See Optimizer.compute_gradients() for more info.
  In DistributedOptimizer, compute_gradients() is overriden to also
  allreduce the gradients before returning them.
docstr_tok: ["Compute","gradients","of","all","trainable","variables",".","See","Optimizer.compute_gradients","(",")","for","more","info",".","In","DistributedOptimizer",",","compute_gradients","(",")","is","overriden","to","also","allreduce","the","gradients","before","returning","them","."]
code: def compute_gradients(self, *args, **kwargs):
      """Compute gradients of all trainable variables.
      See Optimizer.compute_gradients() for more info.
      In DistributedOptimizer, compute_gradients() is overriden to also
      allreduce the gradients before returning them.
      """
      gradients = self._optimizer.compute_gradients(*args, **kwargs)
      results = []
      for grad_var in gradients:
          grad = grad_var[0]
          var = grad_var[1]
          grad = process_grad(grad)
          if grad is not None:
              with tf.control_dependencies([var]):
                  grad_i = tf.identity(
                      grad, name="zoo_identity_op_for_grad"
                  )
              results.append((grad_i, var))
          else:
              results.append((grad, var))
      return results
  
file_path: BigDL/python/orca/src/bigdl/orca/tfpark/zoo_optimizer.py
imports: from bigdl.dllib.optim.optimizer import OptimMethod
  from bigdl.dllib.utils.tf import process_grad
  from bigdl.dllib.utils.log4Error import invalidInputError
  import tensorflow
label_desc: Use image node_id 2 for calling the ZooOptimizer obj's underlying member method code with example usage: obj.compute_gradients() and returns: results