Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.set_deterministic_algorithm_enabled function

PyTorch torch.set_deterministic_algorithm_enabled function


PyTorch torch reference manual 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

print

(

f

"Is deterministic: {torch.are_deterministic_algorithms_enabled()}"

)

Disable deterministic algorithms

torch.

set_deterministic_algorithm_enabled

(

False

)

print

(

f

"Is deterministic: {torch.are_deterministic_algorithms_enabled()}"

)


PyTorch torch reference manual PyTorch torch reference manual