code: def compute_lr_for_step(schedules, learning_rate, train_steps=524288):
      """Get actual LR for step."""
      actual_lr_rates = []
      for lr_schedule in schedules:
          if lr_schedule is None:
              actual_lr_rates.append(learning_rate)
          else:
              converted_schedule = functools.partial(
                  product_learning_rate, factors=lr_schedule
              )
              converted_schedule = functools.partial(
                  converted_schedule, total_train_steps=train_steps
              )
              if callable(converted_schedule):
                  # the following happens on CPU since TPU can't handle summaries.
                  with mtf.utils.outside_all_rewrites():
                      converted_schedule = converted_schedule(
                          step=tf.train.get_global_step()
                      )
                      tf.summary.scalar(
                          "alt_learning_rate", converted_schedule
                      )
              actual_lr_rates.append(converted_schedule)
      return actual_lr_rates
  
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 7 for calling a global function with example usage: compute_lr_for_step(schedules, learning_rate, train_steps) and returns: actual_lr_rates