class_docstr: Base optimizer class.
  
  Constructor of subclasses must take `learning_rate` as an argument.
docstr: Apply gradients to variables.
  
  Call this function externally instead of apply_grad().  This causes the
  operations to be combined, which is necessary for stacking variables
  see mtf.rewrite_stack_variables().
  
  Args:
    grads: a list of Tensor
    variables: a list of Variables
  Returns:
    a list of Operations
docstr_tok: ["Apply","gradients","to","variables",".","Call","this","function","externally","instead","of","apply_grad","(",")",".","This","causes","the","operations","to","be","combined",",","which","is","necessary","for","stacking","variables","see","mtf.rewrite_stack_variables","(",")",".","Args",":","grads",":","a","list","of","Tensor","variables",":","a","list","of","Variables","Returns",":","a","list","of","Operations"]
code: def apply_grads(self, grads, variables):
      """Apply gradients to variables.
  
      Call this function externally instead of apply_grad().  This causes the
      operations to be combined, which is necessary for stacking variables
      see mtf.rewrite_stack_variables().
  
      Args:
        grads: a list of Tensor
        variables: a list of Variables
      Returns:
        a list of Operations
      """
      ops = []
      for grad, var in zip(grads, variables):
          ops.extend(self.apply_grad(grad, var))
      if not ops:
          return ops
      return variables[0].graph.combine_assignments(ops)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import re
  import gin
  from mesh_tensorflow import layers
  from mesh_tensorflow import ops_with_redefined_builtins
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling the Optimizer obj's underlying member method code with example usage: obj.apply_grads(grads, variables) and returns: variables, ops