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: Return the index of the randomizer. The index is useful when the user wants
  to introduce some randomness in the program.
  
  Note:
  The index will increment by one each time this method is called.
  
  Example:
  
  ```python
  # assume we need a randomizer to init the weight of different layers
  # we can use the index of the randomizer to do so that
  # each layer has its own randomizer with a different seed
  base_seed = torch.random.initial_seed()
  seed = base_seed + Randomizer.index()
  randomizer = Randomizer(seed)
  
  with randomizer.fork():
      init_weights()
  ```
docstr_tok: ["Return","the","index","of","the","randomizer",".","The","index","is","useful","when","the","user","wants","to","introduce","some","randomness","in","the","program",".","Note",":","The","index","will","increment","by","one","each","time","this","method","is","called",".","Example",":","``","`","python","#","assume","we","need","a","randomizer","to","init","the","weight","of","different","layers","#","we","can","use","the","index","of","the","randomizer","to","do","so","that","#","each","layer","has","its","own","randomizer","with","a","different","seed","base_seed","=","torch.random.initial_seed","(",")","seed","=","base_seed","+","Randomizer.index","(",")","randomizer","=","Randomizer","(","seed",")","with","randomizer.fork","(",")",":","init_weights","(",")","``","`"]
code: def index():
      """
      Return the index of the randomizer. The index is useful when the user wants
      to introduce some randomness in the program.
  
      Note:
      The index will increment by one each time this method is called.
  
      Example:
  
      ```python
      # assume we need a randomizer to init the weight of different layers
      # we can use the index of the randomizer to do so that
      # each layer has its own randomizer with a different seed
      base_seed = torch.random.initial_seed()
      seed = base_seed + Randomizer.index()
      randomizer = Randomizer(seed)
  
      with randomizer.fork():
          init_weights()
      ```
  
      """
      idx = Randomizer._INDEX
      return idx
  
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 7 for calling the Randomizer obj's underlying member method code with example usage: obj.index() and returns: idx