code: def __update_tensors_state(
      self,
      next_state: TensorState,
      prev_state: Optional[TensorState] = None,
  ):
      for tensor_info in self.tensors_info.values():
          if prev_state is None or tensor_info.state == prev_state:
              self.__update_one_tensor_info(tensor_info, next_state)
  
imports: from dataclasses import dataclass
  from enum import Enum
  from typing import Dict, List, Optional
  import torch
  import torch.distributed
  from torch.distributed import ProcessGroup
  from colossalai.utils import get_current_device
  from colossalai.utils.device import IS_NPU_AVAILABLE
label_desc: Use image node_id 29 for calling the Chunk obj's underlying member method code with example usage: obj.__update_tensors_state(next_state, prev_state) without return types