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

PyTorch torch.use_deterministic_algorithms function

PyTorch torch.use_deterministic_algorithms function


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

print

(

f

"Using deterministic algorithms: {torch.are_deterministic_algorithms_enabled()}"

)

Disable deterministic algorithms

torch.

use_deterministic_algorithms

(

False

)

print

(

f

"Using deterministic algorithms: {torch.are_deterministic_algorithms_enabled()}"

)


PyTorch torch reference manual PyTorch torch reference manual