From 8fe2bf1d7ff266c157d01deb14114930a5fd0d57 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 10 Sep 2019 10:56:56 +0200 Subject: [PATCH] updates --- utils/torch_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/torch_utils.py b/utils/torch_utils.py index 40eed4ae..02543118 100644 --- a/utils/torch_utils.py +++ b/utils/torch_utils.py @@ -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):