torch.profiler
Overview
PyTorch Profiler is a tool that allows the collection of performance
metrics during training and inference. Profiler's context manager API
can be used to better understand what model operators are the most
expensive, examine their input shapes and stack traces, study device
kernel activity and visualize the execution trace.
Note:
An earlier version of the API in "torch.autograd" module is
  considered legacy and will be deprecated.
API Reference
class torch.profiler._KinetoProfile(*, activities=None, record_shapes=False, profile_memory=False, with_stack=False, with_flops=False, with_modules=False, experimental_config=None)
Low-level profiler wrap the autograd profile
Parameters:
      * activities (iterable) -- list of activity groups (CPU,
        CUDA) to use in profiling, supported values:
        "torch.profiler.ProfilerActivity.CPU",
        "torch.profiler.ProfilerActivity.CUDA". Default value: