class_docstr: A helper class that tracks cpu and gpu memory.
  
  This class will silently skip unless `psutil` is available. Install with `pip install psutil`.
  
  When a stage completes, it can pass metrics dict to update with the memory metrics gathered during this stage.
  
  Example :
  
  ```python
  self._memory_tracker = TrainerMemoryTracker(self.args.skip_memory_metrics)
  self._memory_tracker.start()
  # code ...
  metrics = {"train_runtime": 10.5}
  self._memory_tracker.stop_and_update_metrics(metrics)
  ```
  
  At the moment GPU tracking is only for `pytorch`, but can be extended to support `tensorflow`.
  
  To understand this class' intricacies please read the documentation of [`~Trainer.log_metrics`].
class_docstr_tok: ["A","helper","class","that","tracks","cpu","and","gpu","memory",".","This","class","will","silently","skip","unless","`","psutil","`","is","available",".","Install","with","`","pip","install","psutil","`",".","When","a","stage","completes",",","it","can","pass","metrics","dict","to","update","with","the","memory","metrics","gathered","during","this","stage",".","Example",":","``","`","python","self._memory_tracker","=","TrainerMemoryTracker","(","self.args.skip_memory_metrics",")","self._memory_tracker.start","(",")","#","code","...","metrics","=","{","``","train_runtime","''",":","10.5","}","self._memory_tracker.stop_and_update_metrics","(","metrics",")","``","`","At","the","moment","GPU","tracking","is","only","for","`","pytorch","`",",","but","can","be","extended","to","support","`","tensorflow","`",".","To","understand","this","class","'","intricacies","please","read","the","documentation","of","[","`","~Trainer.log_metrics","`","]","."]
docstr: get resident set size memory for the current process
docstr_tok: ["get","resident","set","size","memory","for","the","current","process"]
code: def cpu_mem_used(self):
      """get resident set size memory for the current process"""
      return self.process.memory_info().rss
  
imports: import copy
  import functools
  import gc
  import inspect
  import os
  import random
  import re
  import threading
  import time
  from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
  import numpy
  from .utils import ExplicitEnum, is_psutil_available, is_tf_available, is_torch_available, is_torch_cuda_available, is_torch_tpu_available, requires_backends
label_desc: Use image node_id 3 for calling the TrainerMemoryTracker obj's underlying member method code with example usage: obj.cpu_mem_used() and returns: self