code: def learning_rate_schedule_noam(
      step,
      total_train_steps,
      warmup_steps=10000,
      linear_decay_fraction=0.1,
      multiplier=1.0,
      offset=0,
  ):
      """Noam's favorite learning-rate schedule.
  
      DEPRECATED - use product_learning_rate instead with factors:
  
      [<multiplier>,
       @learning_rate_schedules.truncated_rsqrt,
       @learning_rate_schedules.linear_decay]
  
      (rsqrt(max(step_num, warmup_steps))
       * multiplier
       * min(1.0, (train_steps-step_num)/(train_steps*linear_decay_fraction)))
  
      Args:
        step: a tf.scalar representing the step we want the learning rate for.
        total_train_steps: a number, the total number of training steps.
        warmup_steps: a number
        linear_decay_fraction: a number
        multiplier: a number
        offset: a number used for finetuning. Starts the learning-rate decay
          schedule from this step forwards. Prior to this step, the learning rate is
          the same as if it were a warmup step.
  
      Returns:
        a tf.Scalar, the learning rate for the step.
      """
      train_steps = float(total_train_steps) - offset
      step_num = tf.cast(step, tf.float32) - offset
      learning_rate = tf.math.rsqrt(tf.maximum(step_num, warmup_steps))
      learning_rate *= multiplier
      if linear_decay_fraction > 0:
          learning_rate *= tf.minimum(
              1.0,
              (train_steps - step_num)
              / (train_steps * linear_decay_fraction),
          )
      return learning_rate
  
file_path: mesh/mesh_tensorflow/transformer/learning_rate_schedules.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import gin
  import tensorflow.compat.v1
label_desc: Use image node_id 8 for calling a global function with example usage: learning_rate_schedule_noam(step, total_train_steps, warmup_steps, linear_decay_fraction, multiplier, offset) and returns: learning_rate