generic_utils ¶
Utility functions for general purpose operations like seed setting and tensor manipulation.
Functions:
-
ensure_at_least_1d
–Function to make sure tensors given are not zero dimensional. if they are add one dimension.
-
set_general_seeds
–Set all relevant random seeds to a given value.
ensure_at_least_1d ¶
ensure_at_least_1d(tensor: Tensor) -> Tensor
Function to make sure tensors given are not zero dimensional. if they are add one dimension.
Source code in src/stimulus/utils/generic_utils.py
10 11 12 13 14 |
|
set_general_seeds ¶
Set all relevant random seeds to a given value.
Especially useful in case of ray.tune. Ray does not have a "generic" seed as far as ray 2.23.
Source code in src/stimulus/utils/generic_utils.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|