code: def compute_optimized_running_time(
      optimized_model: BaseInferenceLearner,
      input_data: DataManager,
      steps: int = 100,
      min_steps: int = 5,
      warmup_steps: int = 10,
  ) -> float:
      """Compute the running time of the optimized model.
  
      Args:
          optimized_model (BaseInferenceLearner): Optimized model.
          input_data: (DataManager): Dataset used to compute latency.
          steps (int, optional): Number of input data to be used to
              compute the latency of the model. Default: 100.
          min_steps (int, optional): Minimum number of iterations to
              be performed. Default: 5.
          warmup_steps (int, optional): Number of input data to be used
              to warm up the model. Default: 10.
  
      Returns:
          Float: Average latency.
      """
  
      latencies = []
      last_median = None
  
      # Warmup
      inputs_list = input_data.get_split("test").get_list(warmup_steps)
      for model_inputs in inputs_list:
          _ = optimized_model(*model_inputs)
  
      # Compute latency
      inputs_list = input_data.get_split("test").get_list(steps)
      for model_inputs in inputs_list:
          starting_time = time.time()
          _ = optimized_model(*model_inputs)
          latencies.append(time.time() - starting_time)
          if len(latencies) > min_steps:
              median = np.median(latencies)
              diff = (
                  np.abs(median - last_median) / last_median
                  if last_median is not None
                  else 1.0
              )
              if diff < 0.05:
                  return median
              last_median = median
      return np.median(latencies)
  
file_path: nebuly/optimization/nebullvm/nebullvm/operations/measures/utils.py
imports: import time
  from typing import Tuple, List, Union, Any
  import numpy
  from loguru import logger
  from nebullvm.config import ONNX_PROVIDERS
  from nebullvm.core.models import Device, DeviceType
  from nebullvm.operations.inference_learners.base import BaseInferenceLearner
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import torch, Module
  from nebullvm.tools.data import DataManager
  from nebullvm.tools.onnx import convert_to_numpy, get_input_names, get_output_names
label_desc: Use image node_id 4 for calling a global function with example usage: compute_optimized_running_time(optimized_model, input_data, steps, min_steps, warmup_steps) and returns: np, median