code: def analyze_test_latency(
      test_results: model_handler.TestResultCollection,
      use_cpu_baseline: bool,
  ) -> DataFrame:
      """Analyzes test latency."""
      base_result = (
          test_results.cpu_base_result
          if use_cpu_baseline
          else test_results.gpu_base_result
      )
      if base_result is None:
          raise ValueError(
              f"No {'CPU' if use_cpu_baseline else 'GPU'} baseline found!"
          )
      base_mean_time = np.mean(base_result.model_latency).item()
      column_names = ["time(ms)", "speedup"]
      rows = []
      for result in test_results.results:
          mean_time = np.mean(result.model_latency).item()
          rows.append([mean_time * 1000.0, base_mean_time / mean_time])
      return DataFrame(column_names=column_names, rows=rows)
  
imports: import itertools
  import json
  from typing import Any, Callable, Optional, Sequence, Tuple, Union
  from collections import namedtuple
  import numpy
  from tensorflow.python.compiler.tensorrt.model_tests import model_handler
  import tensorflow.python.compiler.tensorrt.trt_convert
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 2 for calling a global function with example usage: analyze_test_latency(test_results, use_cpu_baseline) and returns: DataFrame