code: def manual_seed(seed: int) -> None:
      """Setup random state from a seed for `torch`, `random` and optionally `numpy` (if can be imported).
  
      Args:
          seed: Random state seed
  
      .. versionchanged:: 0.4.3
          Added ``torch.cuda.manual_seed_all(seed)``.
  
      .. versionchanged:: 0.4.5
          Added ``torch_xla.core.xla_model.set_rng_state(seed)``.
      """
      random.seed(seed)
      torch.manual_seed(seed)
  
      try:
          import torch_xla.core.xla_model as xm
  
          xm.set_rng_state(seed)
      except ImportError:
          pass
  
      try:
          import numpy as np
  
          np.random.seed(seed)
      except ImportError:
          pass
  
imports: import collections.abc
  import functools
  import hashlib
  import logging
  import random
  import shutil
  import warnings
  from pathlib import Path
  from typing import Any, Callable, cast, Dict, List, Optional, TextIO, Tuple, Type, TypeVar, Union
  import torch
label_desc: Use image node_id 8 for calling a global function with example usage: manual_seed(seed) without return types