utils.seed

Random number generation and reproducibility.

utils.seed.fix_random_seed(seed: int = None) int

Controls random number generation reproducibility by setting a consistent seed throughout the project and forcing deterministic implementation of algorithms using the CUDNN backend.

Parameters:

seed (int, optional) – RNG seed value between 0 and 2**32 - 1. If None, a random value will be picked.

Returns:

seed – Returns the value of the seed in case a random value was picked and needs to be recorded.

Return type:

int

Examples

Set random seed across libraries:

>>> fix_random_seed(314)