docstr: get the memory usage of the param, including data and grad
  Returns:
      Tuple[int, int]: cuda mem usage in Byte, cpu memory usage in Byte
docstr_tok: ["get","the","memory","usage","of","the","param",",","including","data","and","grad","Returns",":","Tuple","[","int",",","int","]",":","cuda","mem","usage","in","Byte",",","cpu","memory","usage","in","Byte"]
code: def get_memory_usage(self) -> Tuple[int, int]:
      """
      get the memory usage of the param, including data and grad
      Returns:
          Tuple[int, int]: cuda mem usage in Byte, cpu memory usage in Byte
      """
      cuda_mem_use, cpu_mem_use = 0, 0
  
      def _update_mem_use(t: Optional[torch.Tensor]):
          if t is None:
              return
          assert isinstance(t, torch.Tensor)
          nonlocal cuda_mem_use
          nonlocal cpu_mem_use
          t_cuda, t_cpu = colo_tensor_mem_usage(t)
          cuda_mem_use += t_cuda
          cpu_mem_use += t_cpu
  
      address_set = set()
      _update_mem_use(self.data_payload)
      address_set.add(self.data_payload.data_ptr())
  
      if (
          not self.saved_grad.is_null()
          and self.saved_grad.data_ptr() not in address_set
      ):
          _update_mem_use(self.grad_payload)
          address_set.add(self.saved_grad.data_ptr())
  
      if (
          self.param.data is not None
          and self.param.data.data_ptr() not in address_set
      ):
          _update_mem_use(self.param.data)
          address_set.add(self.param.data.data_ptr())
  
      if (
          self.param.grad is not None
          and self.param.grad.data_ptr() not in address_set
      ):
          _update_mem_use(self.param.grad)
  
      return cuda_mem_use, cpu_mem_use
  
file_path: colossalai/colossalai/legacy/zero/sharded_param/sharded_param.py
imports: from typing import List, Optional, Tuple
  import torch
  from colossalai.legacy.zero.gemini.stateful_tensor import StatefulTensor, TensorState
  from colossalai.legacy.zero.gemini.tensor_utils import colo_tensor_mem_usage
  from .sharded_tensor import ShardedTensor
label_desc: Use image node_id 11 for calling the ShardedParamV2 obj's underlying member method code with example usage: obj.get_memory_usage() and returns: cuda_mem_use,  cpu_mem_use