全局随机性种子,深度学习,pytorch,tensorflow,random
python random 随机性种子
·
# random, numpy
random.seed(123)
np.random.seed(456)
# torch
torch.manual_seed(1111)
torch.cuda.manual_seed(2222)
torch.cuda.manual_seed_all(3333)
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.enabled = True
# tensorflow
from tfdeterminism import patch
patch()
os.environ['PYTHONHASHSEED'] = str(9999)
tensorflow.set_random_seed(7777)
更多推荐

所有评论(0)