code: def apply_grads(self, grads, variables):
      
      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)
docs: 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