docstr: Evaluates throughput of the given batch size.
  
  Return:
      Median throughput in samples / sec.
docstr_tok: ["Evaluates","throughput","of","the","given","batch","size",".","Return",":","Median","throughput","in","samples","\/","sec","."]
code: def evaluate(self, batch_size: int, total_steps: int = 5) -> float:
      """Evaluates throughput of the given batch size.
  
      Return:
          Median throughput in samples / sec.
      """
      durations = []
      for _ in range(total_steps):
          self.reset()
          start_ts = time.time()
          self.step(batch_size)
          durations.append(time.time() - start_ts)
  
      med_duration_s = statistics.median(durations)
      if med_duration_s == 0.0:
          return float("inf")
  
      return batch_size / med_duration_s
  
file_path: ludwig/ludwig/utils/batch_size_tuner.py
imports: import gc
  import logging
  import statistics
  import time
  from abc import ABC
  from typing import Optional
  import torch
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import MAX_BATCH_SIZE_DATASET_FRACTION, MIN_POSSIBLE_BATCH_SIZE
label_desc: Use image node_id 2 for calling the BatchSizeEvaluator obj's underlying member method code with example usage: obj.evaluate(batch_size, total_steps) and returns: unknown, float