SEED = 1234
random.seed(SEED)
np.random.seed(SEED)
torch.manual_seed(SEED)
torch.cuda.manual_seed(SEED)
torch.backends.cudnn.deterministic = True
참고자료
https://hoya012.github.io/blog/reproducible_pytorch/
Reproducible PyTorch를 위한 randomness 올바르게 제어하기!
PyTorch 코드의 완벽한 재현을 위해 고려해야할 randomness를 제어하는 법을 설명드리겠습니다.
hoya012.github.io
What does the difference between 'torch.backends.cudnn.deterministic=True' and 'torch.set_deterministic(True)'?
My network includes 'torch.nn.MaxPool3d' which throw a RuntimeError when cudnn deterministic flag is on according to the PyTorch docs (version 1.7 - https://pytorch.org/docs/stable/generated/torch.
stackoverflow.com
728x90
댓글