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

PyTorch torch.are_deterministic_algorithms_enabled function

PyTorch torch.are_deterministic_algorithms_enabled function


PyTorch torch reference manual PyTorch torch reference manual

torch.are_deterministic_algorithms_enabled is a function in PyTorch used to check whether deterministic algorithms are enabled. Returning True means deterministic algorithms are enabled, which means each run produces the same result.

Function definition

torch.are_deterministic_algorithms_enabled()


Usage examples

Example

import

torch

Check whether deterministic algorithms are enabled

is_deterministic

=

torch.

are_deterministic_algorithms_enabled

(

)

print

(

f

"Deterministic algorithms enabled: {is_deterministic}"

)

Enable deterministic algorithms

torch.

use_deterministic_algorithms

(

True

)

is_deterministic

=

torch.

are_deterministic_algorithms_enabled

(

)

print

(

f

"After setting: {is_deterministic}"

)


PyTorch torch reference manual PyTorch torch reference manual