code: def get_lr_scheduler(learning_rate, lr_refactor_step, lr_refactor_ratio,
                       num_example, batch_size, begin_epoch):
      
      assert lr_refactor_ratio > 0
      iter_refactor = [int(r) for r in lr_refactor_step.split(',') if r.strip()]
      if lr_refactor_ratio >= 1:
          return (learning_rate, None)
      else:
          lr = learning_rate
          epoch_size = num_example // batch_size
          for s in iter_refactor:
              if begin_epoch >= s:
                  lr *= lr_refactor_ratio
          if lr != learning_rate:
              logging.getLogger().info("Adjusted learning rate to {} for epoch {}".format(lr, begin_epoch))
          steps = [epoch_size * (x - begin_epoch) for x in iter_refactor if x > begin_epoch]
          if not steps:
              return (lr, None)
          lr_scheduler = mx.lr_scheduler.MultiFactorScheduler(step=steps, factor=lr_refactor_ratio)
          return (lr, lr_scheduler)
docs: Compute learning rate and refactor scheduler
  
      Parameters:
      ---------
      learning_rate : float
          original learning rate
      lr_refactor_step : comma separated str
          epochs to change learning rate
      lr_refactor_ratio : float
          lr *= ratio at certain steps
      num_example : int
          number of training images, used to estimate the iterations given epochs
      batch_size : int
          training batch size
      begin_epoch : int
          starting epoch
  
      Returns:
      ---------
      (learning_rate, mx.lr_scheduler) as tuple