code: def peak_monitor_func(self):
      self.cpu_mem_used_peak = -1
      self.gpu_mem_used_peak = -1
  
      if self.backend == "pytorch":
          torch_gpu_id = self.torch.cuda.current_device()
          nvml_gpu_id = get_nvml_gpu_id(torch_gpu_id)
          handle = self.pynvml.nvmlDeviceGetHandleByIndex(nvml_gpu_id)
  
      while True:
          self.cpu_mem_used_peak = max(
              cpu_ram_used(), self.cpu_mem_used_peak
          )
  
          if self.backend == "pytorch":
              # no gc.collect, empty_cache here, since it has to be fast and we
              # want to measure only the peak memory usage
              gpu_mem_used = self.gpu_ram_used_fast(handle)
              self.gpu_mem_used_peak = max(
                  gpu_mem_used, self.gpu_mem_used_peak
              )
  
          # can't sleep or will not catch the peak right
          # time.sleep(0.001) # 1msec
  
          if not self.peak_monitoring:
              break
  
imports: from IPython import get_ipython
  from collections import namedtuple
  import datetime
  import gc
  import logging
  import os
  import psutil
  import random
  import sys
  import threading
  import time
label_desc: Use image node_id 11 for calling the CellLogger obj's underlying member method code with example usage: obj.peak_monitor_func() without return types