Pytorch的Reproducibility,可复现性

对于Pytorch的结果复现,在不同版本的pytorch或者不同的硬件平台之间,不能够保证结果是完全一致的,即使在CPU和GPU上采用相同的随机数种子。

关于torch.backend.cudnn.benchmark, (CuDNN backend是什么

torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False

是相对来说确定性的模式。

包括Conv2d这样的函数,In some circumstances when using the CUDA backend with CuDNN, this operator may select a nondeterministic algorithm to increase performance. If this is undesirable, you can try to make the operation deterministic (potentially at a performance cost) by setting torch.backends.cudnn.deterministic = True.