def set_random_seed(seed: Optional[int]=None) -> None:
    'Set random seed for random, numpy, and pytorch.\n\n    Args:\n      seed: The random seed, defaults to `None` which select it randomly.\n    '
    max_value = np.iinfo(np.uint32).max
    min_value = np.iinfo(np.uint32).min
    try:
        seed = int(seed)
        logger.info(f'Set random seed to {seed}.')
    except (TypeError, ValueError):
        seed = random.randint(min_value, max_value)
        logger.info(f'No random seed specified, randomly set random seed to {seed}.')
    if (not (min_value <= seed <= max_value)):
        new_seed = random.randint(min_value, max_value)
        logger.info(f'Random seed {seed} is not valid, randomly set random seed to {new_seed}.')
        seed = new_seed
    random.seed(seed)
    np.random.seed(seed=seed)
    torch.manual_seed(seed)
Set random seed for random, numpy, and pytorch.

Args:
  seed: The random seed, defaults to `None` which select it randomly.
def set_random_seed(seed: Optional[int]=None) -> None:
    'Set random seed for random, numpy, and pytorch.\n\n    Args:\n      seed: The random seed, defaults to `None` which select it randomly.\n    '
    max_value = np.iinfo(np.uint32).max
    min_value = np.iinfo(np.uint32).min
    try:
        seed = int(seed)
        logger.info(f'Set random seed to {seed}.')
    except (TypeError, ValueError):
        seed = random.randint(min_value, max_value)
        logger.info(f'No random seed specified, randomly set random seed to {seed}.')
    if (not (min_value <= seed <= max_value)):
        new_seed = random.randint(min_value, max_value)
        logger.info(f'Random seed {seed} is not valid, randomly set random seed to {new_seed}.')
        seed = new_seed
    random.seed(seed)
    np.random.seed(seed=seed)
    torch.manual_seed(seed)