kk_contour_net_shallow/thesis code/shallow net/functions/set_seed.py
katharinakorb f7e931ba3d
Add files via upload
Additional files used for analysis
2023-11-05 20:14:04 +01:00

12 lines
308 B
Python

import torch
import numpy as np
def set_seed(seed: int, logger) -> None:
# set seed for all used modules
if logger:
logger.info(f"set seed to {seed}")
torch.manual_seed(seed=seed)
if torch.cuda.is_available():
torch.cuda.manual_seed(seed=seed)
np.random.seed(seed=seed)