SEED = 0
torch.manual_seed(SEED)
torch.cuda.manual_seed_all(SEED)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
np.random.seed(SEED)
random.seed(SEED)

 

# References

https://discuss.pytorch.org/t/what-does-torch-backends-cudnn-benchmark-do/5936/7

 

What does torch.backends.cudnn.benchmark do?

Does it work to turn it on for training (where I have a constant input size) and turn it off for validation (where my input size isn’t constant)? Do I just set the constant before doing my validation?

discuss.pytorch.org

 

'LANGUAGE > PyTorch' 카테고리의 다른 글

Solution for Runtime Error: CUDA out of memory  (0) 2020.12.01
BiLSTM  (0) 2019.08.01
PyTorch Examples  (0) 2019.08.01
Random Seed Initialization for Reproducibility ...  (0) 2019.07.15
Difference between model.eval() and torch.no_grad()  (0) 2019.07.15

+ Recent posts