lmp.util.rand#
Randomness utilites.
- lmp.util.rand.set_seed(seed: int) None[source]#
Do best effort to ensure reproducibility on the same machine.
Set random seed on
randommodule,numpy.random,torch.manual_seedandtorch.cuda.- Parameters
seed (int) – Controlled random seed which does best effort to make experiment reproducible. Must be bigger than
0.
See also
numpy.random.seedInitialize the random number generator provided by Numpy.
random.seedInitialize the random number generator provided by Python.
torch.backends.cudnn.benchmarkUse deterministic convolution algorithms.
torch.backends.cudnn.deterministicUse deterministic convolution algorithms.
torch.cuda.manual_seed_allInitialize the random number generator over all CUDA devices.
torch.manual_seedInitialize the random number generator provided by PyTorch.
Notes
Reproducibility is not guaranteed accross different python/numpy/pytorch release, different os platforms or different hardwares (including CPUs and GPUs).