code: def print_latency(latency_set, title, warmup=3):
      # trim warmup queries
      latency_set = latency_set[warmup:]
      count = len(latency_set)
      if count > 0:
          latency_set.sort()
          n50 = (count - 1) * 0.5 + 1
          n90 = (count - 1) * 0.9 + 1
          n95 = (count - 1) * 0.95 + 1
          n99 = (count - 1) * 0.99 + 1
          n999 = (count - 1) * 0.999 + 1
  
          avg = sum(latency_set) / count
          p50 = latency_set[int(n50) - 1]
          p90 = latency_set[int(n90) - 1]
          p95 = latency_set[int(n95) - 1]
          p99 = latency_set[int(n99) - 1]
          p999 = latency_set[int(n999) - 1]
  
          print(f"====== latency stats {title} ======")
          print("\tAvg Latency: {0:8.2f} ms".format(avg * 1000))
          print("\tP50 Latency: {0:8.2f} ms".format(p50 * 1000))
          print("\tP90 Latency: {0:8.2f} ms".format(p90 * 1000))
          print("\tP95 Latency: {0:8.2f} ms".format(p95 * 1000))
          print("\tP99 Latency: {0:8.2f} ms".format(p99 * 1000))
          print("\t999 Latency: {0:8.2f} ms".format(p999 * 1000))
  
imports: import torch
  import time
  import deepspeed
  import argparse
  from transformers import pipeline
label_desc: Use image node_id 1 for calling a global function with example usage: print_latency(latency_set, title, warmup) without return types