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 __setstate__(self, rngs):
      # Note on the following:
      # here we load self.random_generators from the global singleton.
      # We have to do this because, while "rngs" could contain the un-pickled
      # rng functions (load_state, save_state, step), those functions
      # are incorrectly pickled and un-pickled.
      # In other words, they cannot be used to actually re-load the state
      # of the related number generator after closing and reopening
      # the process! This has been tested thanks to a generous expenditure of
      # man-hours.
      # On the other hand, RNGManager.random_generators will contain the
      # "correct" (of the current process) functions linked to the global
      # generators. User will need to register custom generators before
      # un-pickling _RNGManager objects (usually by loading a checkpoint).
      # Also consider that this object will probably not be used...
      # the goal of this __setstate__ is to load the state of the
      # global number generators registered in the singleton.
      self.random_generators = RNGManager.random_generators
      for rng_name, rng_def in self.random_generators.items():
          loaded_state = rngs[rng_name]["current_state"]
          rng_def["load_state"](loaded_state)
  
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 8 for calling the _RNGManager obj's underlying member method code with example usage: obj.__setstate__(rngs) without return types