PyTorch torch.set_deterministic_algorithm_enabled function
PyTorch torch reference manual
torch.set_deterministic_algorithm_enabled is a function in PyTorch used to set deterministic algorithms. It sets whether deterministic algorithms are enabled; once enabled, each run produces the same result.
Function definition
torch.set_deterministic_algorithm_enabled(enabled, mode='warn')
Usage examples
Example
import
torch
Enable deterministic algorithms
torch.
set_deterministic_algorithm_enabled
(
True
)
Check whether it is enabled
(
f
"Is deterministic: {torch.are_deterministic_algorithms_enabled()}"
)
Disable deterministic algorithms
torch.
set_deterministic_algorithm_enabled
(
False
)
(
f
"Is deterministic: {torch.are_deterministic_algorithms_enabled()}"
)