code: def set_seed(seed=0):
      """
      if seed is not 0 set the passed seed val in python, numpy, pytorch, etc. RNGs (if they are loaded)
      """
      if seed == 0:
          return
      logger.debug("Setting seed: {seed}")
  
      # python RNG
      random.seed(seed)
  
      # numpy RNG
      if "numpy" in sys.modules:
          import numpy as np  # ensure symbol defined
  
          np.random.seed(seed)
  
      # pytorch RNGs
      if "torch" in sys.modules:
          import torch  # ensure symbol defined
  
          torch.manual_seed(seed)  # cpu + cuda
          torch.cuda.manual_seed_all(seed)  # multi-gpu
          # slower speed! https://pytorch.org/docs/stable/notes/randomness.html#cudnn
          torch.backends.cudnn.deterministic = True
          torch.backends.cudnn.benchmark = False
  
imports: from IPython import get_ipython
  from collections import namedtuple
  import datetime
  import gc
  import logging
  import os
  import psutil
  import random
  import sys
  import threading
  import time
label_desc: Use image node_id 6 for calling a global function with example usage: set_seed(seed) without return types