code: def compute(self):
      # achieve the core logic of how to average latency
      self.times.sort()
      count = len(self.times)
      if count >= 3:
          threshold = max(int(0.1 * count), 1)
          infer_times_mid = self.times[threshold:-threshold]
      else:
          infer_times_mid = self.times[:]
      latency = sum(infer_times_mid) / len(infer_times_mid)
      return latency
  
imports: from typing import Any
  import torch
  import time
  from pytorch_lightning.callbacks import Callback
  from pytorch_lightning.loops.dataloader.evaluation_loop import EvaluationLoop
  from bigdl.nano.utils.common import invalidInputError
  from collections import ChainMap
  from torchmetrics import Metric
label_desc: Use image node_id 3 for calling the LatencyAggregate obj's underlying member method code with example usage: obj.compute() and returns: latency