code: def record_function(name: str, with_tag: str = "##"):
      """
      Context manager to annotate a scope with meta data used for
      profiling. The tag is used to surround the name.
      """
      import torch.autograd.profiler as profiler
  
      if with_tag:
          name = " ".join([with_tag, name, with_tag])
  
      if is_nvtx_available():
          import nvtx
  
          nvtx_context = nvtx.annotate(message=name)
      else:
          nvtx_context = null_context()
      with profiler.record_function(name), nvtx_context:
          yield
  
imports: import functools
  import logging
  import os
  from contextlib import contextmanager
  from vissl.utils.layer_memory_tracking import null_context
label_desc: Use image node_id 4 for calling a global function with example usage: record_function(name, with_tag) without return types