This commit is contained in:
Glenn Jocher 2019-09-10 10:56:56 +02:00
parent d1b6929043
commit 8fe2bf1d7f
1 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,11 @@ def init_seeds(seed=0):
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
# torch.backends.cudnn.deterministic = True # https://pytorch.org/docs/stable/notes/randomness.html
# Remove randomness (may be slower on Tesla GPUs) # https://pytorch.org/docs/stable/notes/randomness.html
if seed == 0:
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
def select_device(force_cpu=False, apex=False):