class_docstr: Layer by layer profiling of PyTorch models, using the PyTorch profiler
  for memory profiling. Parts of the code are adapted from :obj:`torchprof`
  for layer-wise grouping.
  
  Args:
      model (torch.nn.Module): The underlying model to be profiled.
      enabled (bool, optional): If set to :obj:`True`, turn on the profiler.
          (default: :obj:`False`)
      use_cuda (bool, optional): Whether to profile CUDA execution.
          (default: :obj:`False`)
      profile_memory (bool, optional): If set to :obj:`True`, also profile
          memory usage. (default: :obj:`False`)
      paths ([str], optional): Pre-defined paths for fast loading.
          (default: :obj:`None`)
docstr: Clean it up after the profiling is done.
docstr_tok: ["Clean","it","up","after","the","profiling","is","done","."]
code: def _remove_hook_trace(self, trace):
      """Clean it up after the profiling is done."""
      [path, leaf, module] = trace
      _id = id(module)
      if _id in self._ids:
          self._ids.discard(_id)
      else:
          return
      if (self.paths is not None and path in self.paths) or (
          self.paths is None and leaf
      ):
          module.forward = self._forwards[path]
  
imports: import functools
  from collections import OrderedDict, defaultdict, namedtuple
  from typing import Any, List, NamedTuple, Optional, Tuple
  import torch
  import torch.profiler
label_desc: Use image node_id 8 for calling the Profiler obj's underlying member method code with example usage: obj._remove_hook_trace(trace) without return types