zero.random.init¶
-
zero.random.init(seed, cudnn_deterministic=True, cudnn_benchmark=False)[source]¶ Set seeds and settings in
random,numpyandtorch.Sets random seed in
random,numpy.random,torch,torch.cudaand sets settings intorch.backends.cudnn.- Parameters
- Returns
- if
seedis set toNone, the generated seed is returned; otherwise the
seedargument is returned as is
- if
- Return type
seed
Note
If you don’t want to set the seed by hand, but still want to have a chance to reproduce things, you can use the following pattern:
print('Seed:', zero.random.init(None))
Examples
assert zero.random.init(0) == 0 generated_seed = zero.random.init(None)