code: def progress_bar(total, prefix="", si_prefix="G"):
      """Display progress bar for tuning
  
      Parameters
      ----------
      total: int
          The total number of trials
      prefix: str
          The prefix of output message
      si_prefix: str
          SI prefix for flops
      """
  
      class _Context(object):
          """Context to store local variables"""
  
          def __init__(self):
              self.best_flops = 0
              self.cur_flops = 0
              self.ct = 0
              self.total = total
  
          def __del__(self):
              if (
                  logger.level < logging.DEBUG
              ):  # only print progress bar in non-debug mode
                  sys.stdout.write(" Done.\n")
  
      ctx = _Context()
      tic = time.time()
  
      # Validate si_prefix argument
      format_si_prefix(0, si_prefix)
  
      if (
          logger.level < logging.DEBUG
      ):  # only print progress bar in non-debug mode
          sys.stdout.write(
              "\r%s Current/Best: %7.2f/%7.2f %sFLOPS | Progress: (%d/%d) "
              "| %.2f s"
              % (prefix, 0, 0, si_prefix, 0, total, time.time() - tic)
          )
          sys.stdout.flush()
  
      def _callback(tuner, inputs, results):
          ctx.ct += len(inputs)
  
          flops = 0
          for inp, res in zip(inputs, results):
              if res.error_no == 0:
                  flops = inp.task.flop / np.mean(res.costs)
  
          if not logger.isEnabledFor(
              logging.DEBUG
          ):  # only print progress bar in non-debug mode
              ctx.cur_flops = flops
              ctx.best_flops = tuner.best_flops
  
              sys.stdout.write(
                  "\r%s Current/Best: %7.2f/%7.2f %sFLOPS | Progress: (%d/%d) "
                  "| %.2f s"
                  % (
                      prefix,
                      format_si_prefix(ctx.cur_flops, si_prefix),
                      format_si_prefix(ctx.best_flops, si_prefix),
                      si_prefix,
                      ctx.ct,
                      ctx.total,
                      time.time() - tic,
                  )
              )
              sys.stdout.flush()
  
      return _callback
  
file_path: tvm/python/tvm/autotvm/tuner/callback.py
imports: import sys
  import time
  import logging
  import numpy
  from ..None import record
  from ..utils import format_si_prefix
label_desc: Use image node_id 3 for calling a global function with example usage: progress_bar(total, prefix, si_prefix) and returns: _callback