class_docstr: Profiler that triggers start of NSight profiler.
  
  NOTE: you need to ensure that the script running this code actually is running with
  ``nsys profile`` and also has a flag ``--capture-range=cudaProfilerApi`` so the
  capturing is performed by this profiler during certain steps.
class_docstr_tok: ["Profiler","that","triggers","start","of","NSight","profiler",".","NOTE",":","you","need","to","ensure","that","the","script","running","this","code","actually","is","running","with","``","nsys","profile","``","and","also","has","a","flag","``","--","capture-range=cudaProfilerApi","``","so","the","capturing","is","performed","by","this","profiler","during","certain","steps","."]
code: def __init__(self, main_profiler: "_Profiler") -> None:
      self.main_profiler = main_profiler
  
imports: import logging
  import os
  import queue
  import socket
  import weakref
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, List, Optional, Sequence, Tuple
  import torch.cuda.memory
  import torch.cuda.nvtx
  import torch.nn
  import torch.profiler
  import torch.utils.hooks
label_desc: Use image node_id 1 to create a new NsightProfiler object  with example: obj = NsightProfiler(main_profiler)