(Potentially) set the seed for numpy, torch and random. If no seed is provided, nothing happens.
Parameters:
Name |
Type |
Description |
Default |
seed |
Optional[int]
|
|
None
|
Source code in src/nhssynth/common/common.py
| def set_seed(seed: Optional[int] = None) -> None:
"""
(Potentially) set the seed for numpy, torch and random. If no seed is provided, nothing happens.
Args:
seed: The seed to set.
"""
if seed:
np.random.seed(seed)
torch.manual_seed(seed)
random.seed(seed)
|