class_docstr: Timer for PyTorch code Comes in the form of a contextmanager:
  
  Example:
  >>> timer = Timer()
  ... for i in range(10):
  ...     with timer("expensive operation"):
  ...         x = torch.randn(100)
  ... print(timer.summary())
class_docstr_tok: ["Timer","for","PyTorch","code","Comes","in","the","form","of","a","contextmanager",":","Example",":",">",">",">","timer","=","Timer","(",")","...","for","i","in","range","(","10",")",":","...","with","timer","(","``","expensive","operation","''",")",":","...","x","=","torch.randn","(","100",")","...","print","(","timer.summary","(",")",")"]
docstr: Reset the timer.
docstr_tok: ["Reset","the","timer","."]
code: def reset(self):
      """
      Reset the timer.
      """
      self.totals = {}  # Total time per label
      self.first_time = {}  # First occurrence of a label (start time)
      self.last_time = {}  # Last occurence of a label (end time)
      self.call_counts = {}
  
file_path: gluonts/src/gluonts/nursery/SCott/trainers/timer.py
imports: import time
  from contextlib import contextmanager
  from io import StringIO
  import numpy
  import torch
label_desc: Use image node_id 2 for calling the Timer obj's underlying member method code with example usage: obj.reset() without return types