parameters: (self, param)
docstring: Callback to Show speed.
docstring_summary: Callback to Show speed.
docstring_tokens: Callback to Show speed .
function: def __call__(self, param):
          """Callback to Show speed."""
          count = param.nbatch
          if self.last_count > count:
              self.init = False
          self.last_count = count
  
          if self.init:
              if count % self.frequent == 0:
                  # #11504
                  try:
                      speed = self.frequent * self.batch_size / (time.time() - self.tic)
                  except ZeroDivisionError:
                      speed = float('inf')
                  if param.eval_metric is not None:
                      name_value = param.eval_metric.get_name_value()
                      if self.auto_reset:
                          param.eval_metric.reset()
                          msg = 'Epoch[%d] Batch [%d-%d]\tSpeed: %.2f samples/sec'
                          msg += '\t%s=%f'*len(name_value)
                          logging.info(msg, param.epoch, count-self.frequent, count, speed, *sum(name_value, ()))
                      else:
                          msg = 'Epoch[%d] Batch [0-%d]\tSpeed: %.2f samples/sec'
                          msg += '\t%s=%f'*len(name_value)
                          logging.info(msg, param.epoch, count, speed, *sum(name_value, ()))
                  else:
                      logging.info("Iter[%d] Batch [%d]\tSpeed: %.2f samples/sec",
                                   param.epoch, count, speed)
                  self.tic = time.time()
          else:
              self.init = True
              self.tic = time.time()
function_tokens: def __call__ ( self , param ) : count = param . nbatch if self . last_count > count : self . init = False self . last_count = count if self . init : if count % self . frequent == 0 : # #11504 try : speed = self . frequent * self . batch_size / ( time . time ( ) - self . tic ) except ZeroDivisionError : speed = float ( 'inf' ) if param . eval_metric is not None : name_value = param . eval_metric . get_name_value ( ) if self . auto_reset : param . eval_metric . reset ( ) msg = 'Epoch[%d] Batch [%d-%d]\tSpeed: %.2f samples/sec' msg += '\t%s=%f' * len ( name_value ) logging . info ( msg , param . epoch , count - self . frequent , count , speed , * sum ( name_value , ( ) ) ) else : msg = 'Epoch[%d] Batch [0-%d]\tSpeed: %.2f samples/sec' msg += '\t%s=%f' * len ( name_value ) logging . info ( msg , param . epoch , count , speed , * sum ( name_value , ( ) ) ) else : logging . info ( "Iter[%d] Batch [%d]\tSpeed: %.2f samples/sec" , param . epoch , count , speed ) self . tic = time . time ( ) else : self . init = True self . tic = time . time ( )