set_state#

delu.random.set_state(state: Dict[str, Any], /, cuda: bool = True) None[source]#

Set the global random number generator states in random, numpy and torch.

Usage

See delu.random.get_state for usage examples.

Parameters:

state – the dict with the states produced by delu.random.get_state. If the 'torch.cuda' key is presented in state, then it must be a list of the size equal to the device count as reported by torch.cuda.device_count. If 'torch.cuda' is not presented in state, the state of the CUDA global RNGs is not set.