speed-reproducibility fix #17

This commit is contained in:
Glenn Jocher committed 2020-06-05 13:07:09 -07:00
1 parent 55ca5c74d2
commit 22d6088205
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -12,8 +12,11 @@ import torch.nn.functional as F
def init_seeds(seed=0):
torch.manual_seed(seed)
# Reduce randomness (may be slower on Tesla GPUs) # https://pytorch.org/docs/stable/notes/randomness.html
if seed == 0:
# Speed-reproducibility tradeoff https://pytorch.org/docs/stable/notes/randomness.html
if seed == 0: # slower, more reproducible
cudnn.deterministic = True
cudnn.benchmark = False
else: # faster, less reproducible
cudnn.deterministic = False
cudnn.benchmark = True