delu.random.seed#

delu.random.seed(base_seed, one_cuda_seed=False)[source]#

Set seeds in random, numpy and torch.

For all libraries, different seeds (which are deterministically computed based on the base_seed argument) are set (see the note below).

Parameters:
  • base_seed (int) – the number used to determine random seeds for all libraries and hardware. Must be a non-negative number less than 2 ** 32 - 10000.

  • one_cuda_seed (bool) – if True, then the same seed will be set for all cuda devices, otherwise, different seeds will be set for all cuda devices.

Raises:

AssertionError – if the seed is not within the required interval

Return type:

None

Note

Different seeds are set to avoid situations where different libraries or devices generate the same random sequences. See this comment for details.

Examples

delu.random.seed(0)