class_docstr: Encapsulates numerical tracking of a single metric, with a `.update(value)` API.
  Under-the-hood this can additionally keep track of sums, (exp.) moving averages,
  sum of squares (e.g. for stdev), filtered values, etc.
class_docstr_tok: ["Encapsulates","numerical","tracking","of","a","single","metric",",","with","a","`",".update","(","value",")","`","API",".","Under-the-hood","this","can","additionally","keep","track","of","sums",",","(","exp",".",")","moving","averages",",","sum","of","squares","(","e.g",".","for","stdev",")",",","filtered","values",",","etc","."]
code: def __init__(self):
      self.last_value: Optional[float] = None
      self.smoothed_value: Optional[float] = None
  
      self.sum_values: float = 0.0
      self.num_updates: int = 0
  
imports: import logging
  from collections import defaultdict, deque
  from time import perf_counter
  from typing import List, Mapping, Optional, Tuple
  import torch
  from torch.cuda import Event
label_desc: Use image node_id 1 to create a new PerfMetric object  with example: obj = PerfMetric()