PyTorch torch.use_deterministic_algorithms function
PyTorch torch reference manual
torch.use_deterministic_algorithms is a function in PyTorch used to use deterministic algorithms. It sets whether to use deterministic algorithms whenever possible.
Function definition
torch.use_deterministic_algorithms(enabled, warn_only=False)
Usage examples
Example
import
torch
Enable deterministic algorithms
torch.
use_deterministic_algorithms
(
True
)
Check whether it is enabled
(
f
"Using deterministic algorithms: {torch.are_deterministic_algorithms_enabled()}"
)
Disable deterministic algorithms
torch.
use_deterministic_algorithms
(
False
)
(
f
"Using deterministic algorithms: {torch.are_deterministic_algorithms_enabled()}"
)