class_docstr: Sequence-to-sequence base class.
class_docstr_tok: ["Sequence-to-sequence","base","class","."]
docstr: Get learning rate warmup.
docstr_tok: ["Get","learning","rate","warmup","."]
code: def _get_learning_rate_warmup(self, hparams):
      """Get learning rate warmup."""
      warmup_steps = hparams.warmup_steps
      warmup_scheme = hparams.warmup_scheme
      utils.print_out(
          "  learning_rate=%g, warmup_steps=%d, warmup_scheme=%s"
          % (hparams.learning_rate, warmup_steps, warmup_scheme)
      )
  
      # Apply inverse decay if global steps less than warmup steps.
      # Inspired by https://arxiv.org/pdf/1706.03762.pdf (Section 5.3)
      # When step < warmup_steps,
      #   learing_rate *= warmup_factor ** (warmup_steps - step)
      if warmup_scheme == "t2t":
          # 0.01^(1/warmup_steps): we start with a lr, 100 times smaller
          warmup_factor = tf.exp(tf.log(0.01) / warmup_steps)
          inv_decay = warmup_factor ** (
              tf.to_float(warmup_steps - self.global_step)
          )
      else:
          raise ValueError("Unknown warmup scheme %s" % warmup_scheme)
  
      return tf.cond(
          self.global_step < hparams.warmup_steps,
          lambda: inv_decay * self.learning_rate,
          lambda: self.learning_rate,
          name="learning_rate_warump_cond",
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import collections
  import tensorflow
  from tensorflow.contrib.model_pruning import get_masks, get_thresholds
  from tensorflow.contrib.model_pruning.python import pruning
  from tensorflow.contrib.model_pruning.python.layers import core_layers
  from .None import model_helper
  from .utils import misc_utils, iterator_utils
label_desc: Use image node_id 4 for calling the BaseModel obj's underlying member method code with example usage: obj._get_learning_rate_warmup(hparams) and returns: tf