AVP-Pro / util /seed.py
Wwwy1031's picture
Create seed.py
4e010c6 verified
raw
history blame contribute delete
359 Bytes
import os
import random
import numpy as np
import torch
def set_seed(seed=1064):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False