class_docstr: Context manager that manages autograd profiler state and holds a summary of results.
  
  Under the hood it just records events of functions being executed in C++ and
  exposes those events to Python. You can wrap any code into it and it will
  only report runtime of PyTorch functions.
  Note: profiler is thread local and is automatically propagated into the async tasks
  
  Args:
      enabled (bool, optional): Setting this to False makes this context manager a no-op.
  
      use_cuda (bool, optional): Enables timing of CUDA events as well using the cudaEvent API.
          Adds approximately 4us of overhead to each tensor operation.
  
      record_shapes (bool, optional): If shapes recording is set, information
          about input dimensions will be collected. This allows one to see which
          dimensions have been used under the hood and further group by them
          using prof.key_averages(group_by_input_shape=True). Please note that
          shape recording might skew your profiling data. It is recommended to
          use separate runs with and without shape recording to validate the timing.
          Most likely the skew will be negligible for bottom most events (in a case
          of nested function calls). But for higher level functions the total
          self cpu time might be artificially increased because of the shape
          collection.
  
      with_flops (bool, optional): If with_flops is set, the profiler will estimate
          the FLOPs (floating point operations) value using the operator's input shape.
          This allows one to estimate the hardware performance. Currently,
          this option only works for the matrix multiplication and 2D convolution operators.
  
      profile_memory (bool, optional): track tensor memory allocation/deallocation.
  
      with_stack (bool, optional): record source information (file and line number) for the ops.
  
      with_modules (bool): record module hierarchy (including function names)
          corresponding to the callstack of the op. e.g. If module A's forward call's
          module B's forward which contains an aten::add op,
          then aten::add's module hierarchy is A.B
          Note that this support exist, at the moment, only for TorchScript models
          and not eager mode models.
  
      use_kineto (bool, optional): experimental, enable profiling with Kineto profiler.
  
      use_cpu (bool, optional): profile CPU events; setting to ``False`` requires
          ``use_kineto=True`` and can be used to lower the overhead for GPU-only profiling.
  
      experimental_config (_ExperimentalConfig) : A set of experimental options
          used by profiler libraries like Kineto. Note, backward compatibility is not guaranteed.
  
  
  .. warning:
      Enabling memory profiling or source attribution incurs additional profiler
      overhead
  
  .. warning:
      This context managers should not be called recursively, i.e. no nested
      instances are allowed
  
  .. warning:
      Due to some CUDA multiprocessing limitations (multiprocessing-cuda-note_),
      one cannot use the profiler with ``use_cuda = True`` to benchmark
      DataLoaders with ``num_workers > 0``. If you wish to benchmark data loading,
      please use ``use_cuda = False`` or ``num_workers = 0``.
  
  Example:
      >>> # xdoctest: +SKIP
      >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_AUTOGRAD_PROFILER)
      >>> x = torch.randn((1, 1), requires_grad=True)
      >>> with torch.autograd.profiler.profile() as prof:
      >>>     for _ in range(100):  # any normal python code, really!
      >>>         y = x ** 2
      >>>         y.backward()
      >>> # NOTE: some columns were removed for brevity
      >>> print(prof.key_averages().table(sort_by="self_cpu_time_total"))
      -----------------------------------  ---------------  ---------------  ---------------
      Name                                 Self CPU total   CPU time avg     Number of Calls
      -----------------------------------  ---------------  ---------------  ---------------
      mul                                  32.048ms         32.048ms         200
      pow                                  27.041ms         27.041ms         200
      PowBackward0                         9.727ms          55.483ms         100
      torch::autograd::AccumulateGrad      9.148ms          9.148ms          100
      torch::autograd::GraphRoot           691.816us        691.816us        100
      -----------------------------------  ---------------  ---------------  ---------------
code: def _prepare_trace(self):
      self.entered = True
      _prepare_profiler(self.config(), self.kineto_activities)
  
imports: from collections import defaultdict
  from typing import Any, Dict, List, Optional
  from warnings import warn
  import torch
  import torch.cuda
  from torch._C import _get_privateuse1_backend_name
  from torch._C._profiler import _ExperimentalConfig
  from torch.autograd import _disable_profiler, _enable_profiler, _kineto_step, _prepare_profiler, _ProfilerResult, _supported_activities, DeviceType, kineto_available, ProfilerActivity, ProfilerConfig, ProfilerState
  from torch.autograd.profiler_util import _filter_name, _filter_stack_entry, _rewrite_name, EventList, FunctionEvent, MEMORY_EVENT_NAME, MemRecordsAcc, OUT_OF_MEMORY_EVENT_NAME
  from torch.futures import Future
label_desc: Use image node_id 4 for calling the profile obj's underlying member method code with example usage: obj._prepare_trace() without return types