code: def get_random_generator_state(cuda=torch.cuda.is_available()):
      """Get the `torch`, `numpy` and `random` random generator state.
  
      Args:
          cuda (bool, optional): If `True` saves the `cuda` seed also. Note that getting and setting
              the random generator state for CUDA can be quite slow if you have a lot of GPUs.
  
      Returns:
          RandomGeneratorState
      """
      return RandomGeneratorState(
          random.getstate(),
          torch.random.get_rng_state(),
          np.random.get_state(),
          torch.cuda.get_rng_state_all() if cuda else None,
      )
  
file_path: pywick/pywick/cust_random.py
imports: from collections import namedtuple
  from contextlib import contextmanager
  import functools
  import random
  import numpy
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: get_random_generator_state(cuda) and returns: RandomGeneratorState