class_docstr: Wrapper around the profilers of Pytorch to provide a uniform
  interface, independent of the chosen implementation
code: def export_key_averages(self, folder: str, rank: int):
      key_averages = self.profiler.key_averages()
      for stat_type in ["cpu_time", "cuda_time", "cuda_memory_usage"]:
          file_name = f"{stat_type}_rank{rank}.txt"
          file_path = os.path.abspath(os.path.join(folder, file_name))
          logging.info(f"Exporting {stat_type} to: {file_path}")
          with open(file_path, "w") as f:
              print(key_averages.table(sort_by=stat_type), file=f)
  
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 6 for calling the Profiler obj's underlying member method code with example usage: obj.export_key_averages(folder, rank) without return types