class_docstr: A manager class to manipulate the tensors in chunks.
  
  Args:
      chunk_configuration (Dict[int, Dict]): the configuration dictionary of this chunk manager.
      init_device (torch.device): optional, the device on which the chunk is initialized. The default is None.
class_docstr_tok: ["A","manager","class","to","manipulate","the","tensors","in","chunks",".","Args",":","chunk_configuration","(","Dict","[","int",",","Dict","]",")",":","the","configuration","dictionary","of","this","chunk","manager",".","init_device","(","torch.device",")",":","optional",",","the","device","on","which","the","chunk","is","initialized",".","The","default","is","None","."]
docstr: Add extern static tensor to chunk manager.
  Those tensors won't be managed by chunk manager, but we want to monitor memory usage of them.
  They are "static", which means their shape, dtype, device never change.
  Thus, their memory usage never changes.
  
  Args:
      tensor (torch.Tensor): An extern static tensor. E.g. optimizer state.
docstr_tok: ["Add","extern","static","tensor","to","chunk","manager",".","Those","tensors","wo","n't","be","managed","by","chunk","manager",",","but","we","want","to","monitor","memory","usage","of","them",".","They","are","``","static","''",",","which","means","their","shape",",","dtype",",","device","never","change",".","Thus",",","their","memory","usage","never","changes",".","Args",":","tensor","(","torch.Tensor",")",":","An","extern","static","tensor",".","E.g",".","optimizer","state","."]
code: def add_extern_static_tensor(self, tensor: torch.Tensor) -> None:
      """Add extern static tensor to chunk manager.
      Those tensors won't be managed by chunk manager, but we want to monitor memory usage of them.
      They are "static", which means their shape, dtype, device never change.
      Thus, their memory usage never changes.
  
      Args:
          tensor (torch.Tensor): An extern static tensor. E.g. optimizer state.
      """
      assert tensor not in self.tensor_chunk_map
      device_type = tensor.device.type
      if device_type == "npu":
          device_type = "cuda"
      self.total_mem[device_type] += (
          tensor.numel() * tensor.element_size()
      )
  
imports: from collections import deque
  from typing import Deque, Dict, Iterable, List, Optional, Set, Tuple
  import torch
  import torch.distributed
  from torch.distributed import ProcessGroup
  from colossalai.utils import free_storage, get_current_device
  from .chunk import Chunk, ChunkFullError, TensorState
label_desc: Use image node_id 14 for calling the ChunkManager obj's underlying member method code with example usage: obj.add_extern_static_tensor(tensor) without return types