class_docstr: A class used to manage a set of deterministic random number generators.
  
  The main goal of this class is to provide a simplified mechanism to
  improve determinism on the RNG side. This class includes a method to set
  a manual seed of all number generators and a method to register new
  generators.
  
  By default, Python (`random` module), NumPy, and PyTorch global generators
  are managed.
class_docstr_tok: ["A","class","used","to","manage","a","set","of","deterministic","random","number","generators",".","The","main","goal","of","this","class","is","to","provide","a","simplified","mechanism","to","improve","determinism","on","the","RNG","side",".","This","class","includes","a","method","to","set","a","manual","seed","of","all","number","generators","and","a","method","to","register","new","generators",".","By","default",",","Python","(","`","random","`","module",")",",","NumPy",",","and","PyTorch","global","generators","are","managed","."]
code: def _register_default_generators(self):
      self.register_random_generator(
          "torch",
          {
              "seed": cpu_rng_seed,
              "save_state": torch.random.get_rng_state,
              "load_state": torch.random.set_rng_state,
              "step": lambda: torch.rand(1),
          },
      )
  
      self.register_random_generator(
          "torch.cuda",
          {
              "seed": cuda_rng_seed,
              "save_state": cuda_rng_save_state,
              "load_state": cuda_rng_load_state,
              "step": cuda_rng_step,
          },
      )
  
      self.register_random_generator(
          "numpy",
          {
              "seed": np.random.seed,
              "save_state": np.random.get_state,
              "load_state": np.random.set_state,
              "step": lambda: np.random.rand(1),
          },
      )
  
      self.register_random_generator(
          "random",
          {
              "seed": random.seed,
              "save_state": random.getstate,
              "load_state": random.setstate,
              "step": random.random,
          },
      )
  
file_path: avalanche/avalanche/training/determinism/rng_manager.py
imports: import random
  from collections import OrderedDict
  from typing import Any, Dict, Type
  import numpy
  import torch
  from avalanche.training.determinism.cuda_rng import cuda_rng_seed, cuda_rng_save_state, cuda_rng_load_state, cuda_rng_step, cpu_rng_seed
label_desc: Use image node_id 3 for calling the _RNGManager obj's underlying member method code with example usage: obj._register_default_generators() without return types