class_docstr: Execution Trace Observer
  
  Each process can have a single ExecutionTraceObserver instance. The observer
  can be added to record function callbacks via calling register_callback()
  explicitly. Without calling unregister_callback(), repeated calls to
  register_callback() will not add additional observers to record function
  callbacks. Once an ExecutionTraceObserver is created, the start() and stop()
  methods control when the event data is recorded.
  
  Deleting or calling unregister_callback() will remove the observer from the
  record function callbacks, finalize the output file, and will stop
  incurring any overheads.
class_docstr_tok: ["Execution","Trace","Observer","Each","process","can","have","a","single","ExecutionTraceObserver","instance",".","The","observer","can","be","added","to","record","function","callbacks","via","calling","register_callback","(",")","explicitly",".","Without","calling","unregister_callback","(",")",",","repeated","calls","to","register_callback","(",")","will","not","add","additional","observers","to","record","function","callbacks",".","Once","an","ExecutionTraceObserver","is","created",",","the","start","(",")","and","stop","(",")","methods","control","when","the","event","data","is","recorded",".","Deleting","or","calling","unregister_callback","(",")","will","remove","the","observer","from","the","record","function","callbacks",",","finalize","the","output","file",",","and","will","stop","incurring","any","overheads","."]
docstr: Calls unregister_callback() to make sure to finalize outputs.
code: def __del__(self):
      """
      Calls unregister_callback() to make sure to finalize outputs.
      """
      self.unregister_callback()
  
imports: import gzip
  import json
  import os
  import tempfile
  from enum import Enum
  from functools import partial
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
  from warnings import warn
  import torch
  import torch.autograd.profiler
  from torch._C import _get_privateuse1_backend_name
  from torch._C._profiler import _add_execution_trace_observer, _disable_execution_trace_observer, _enable_execution_trace_observer, _ExperimentalConfig, _remove_execution_trace_observer
  from torch.autograd import kineto_available, ProfilerActivity
  from torch.profiler._memory_profiler import MemoryProfile, MemoryProfileTimeline
label_desc: Use image node_id 2 for calling the ExecutionTraceObserver obj's underlying member method code with example usage: obj.__del__() without return types