import torch import random import os import numpy as np def seed_setting(seed): random.seed(seed) # os.environ['']=str(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False
标签:random,torch,manual,cudnn,seed,种子,深度,import,锁死 From: https://www.cnblogs.com/yyhappy/p/17772261.html