class_docstr: Adam with SGD updates every n steps with accumulated gradients.
class_docstr_tok: ["Adam","with","SGD","updates","every","n","steps","with","accumulated","gradients","."]
docstr: Updates beta_power variables every n batches and incrs counter.
docstr_tok: ["Updates","beta_power","variables","every","n","batches","and","incrs","counter","."]
code: def _finish(self, update_ops, name_scope):
      """Updates beta_power variables every n batches and incrs counter."""
      iter_ = self._get_iter_variable()
      beta1_power, beta2_power = self._get_beta_accumulators()
      with tf.control_dependencies(update_ops):
          with tf.colocate_with(iter_):
  
              def update_beta_op():
                  update_beta1 = beta1_power.assign(
                      beta1_power * self._beta1_t,
                      use_locking=self._use_locking,
                  )
                  update_beta2 = beta2_power.assign(
                      beta2_power * self._beta2_t,
                      use_locking=self._use_locking,
                  )
                  return tf.group(update_beta1, update_beta2)
  
              maybe_update_beta = tf.cond(
                  tf.equal(iter_, 0), update_beta_op, tf.no_op
              )
              with tf.control_dependencies([maybe_update_beta]):
                  # TODO(cuong): It is suboptimal here because we have to cast twice
                  # (float to int, and then int to float)
                  update_iter = iter_.assign(
                      tf.cast(
                          tf.mod(
                              tf.cast(iter_ + 1.0, tf.int32), self._n_t
                          ),
                          tf.float32,
                      ),
                      use_locking=self._use_locking,
                  )
      return tf.group(
          *update_ops + [update_iter, maybe_update_beta],
          name=name_scope,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow.compat.v1
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.training import training_ops
label_desc: Use image node_id 16 for calling the MultistepAdamOptimizer obj's underlying member method code with example usage: obj._finish(update_ops, name_scope) and returns: tf, tf