zero.random.set_state¶
-
zero.random.
set_state
(state)[source]¶ Set global random states from
random
,numpy
andtorch
.The argument must be produced by
get_state
.Note
The size of list
state['torch.cuda']
must be equal to the number of available cuda devices. If random state of cuda devices is not important, remove the entry ‘torch.cuda’ from the state beforehand, or, at your own risk adjust its value.See also
- Raises
AssertionError – if
torch.cuda.device_count() != len(state['torch.cuda'])
- Parameters
state (Dict[str, Any]) –
- Return type