class_docstr: Randomizer enables the program to be executed under a different seed within the context.
  
  Example:
  
  ```python
  randomizer = Randomizer(seed=1024)
  
  with randomizer.fork():
      # do something here with seed 1024
      do_something()
  ```
  
  Args:
      seed (int): The random seed to set.
      enable_cpu (bool): fork the CPU RNG state as well.
      with_index (bool): whether to use the index of the randomizer.
docstr: This is a context manager to change the dropout state and recover the original state.
  
  Usage:
  ::
      >>> with _seed_manager.dropout_mode():
      >>>     input = super().forward(input)
docstr_tok: ["This","is","a","context","manager","to","change","the","dropout","state","and","recover","the","original","state",".","Usage",":",":",":",">",">",">","with","_seed_manager.dropout_mode","(",")",":",">",">",">","input","=","super","(",")",".forward","(","input",")"]
code: def fork_rng(self, enable_cpu: bool = False):
      """
      This is a context manager to change the dropout state and recover the original state.
  
      Usage:
      ::
          >>> with _seed_manager.dropout_mode():
          >>>     input = super().forward(input)
      """
      try:
          current_device_rng_state = self._get_device_rng_state()
          self._set_device_rng_state(self.device_rng_state)
  
          if enable_cpu:
              current_cpu_rng_state = self._get_cpu_rng_state()
              self._set_cpu_rng_state(self.cpu_rng_state)
          yield
      finally:
          self.device_rng_state = self._get_device_rng_state()
          self._set_device_rng_state(current_device_rng_state)
  
          if enable_cpu:
              self.cpu_rng_state = self._get_cpu_rng_state()
              self._set_cpu_rng_state(current_cpu_rng_state)
  
imports: from contextlib import contextmanager
  from typing import List
  import torch
  import torch.distributed
  from torch import nn
  from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
  from torch.distributed import ProcessGroup, get_world_size
  from colossalai.utils.device import get_current_device, get_rng_state, set_rng_state, manual_seed
label_desc: Use image node_id 6 for calling the Randomizer obj's underlying member method code with example usage: obj.fork_rng(enable_cpu) without return types