PyTorch torch.are_deterministic_algorithms_enabled Function


Pytorch torch 参考手册PyTorch torch Reference Manual

torch.are_deterministic_algorithms_enabledIt is a function in PyTorch used to check whether deterministic algorithms are enabled. Returning True indicates that deterministic algorithms are enabled, meaning the same result will be produced with every run.

Function Definition

torch.are_deterministic_algorithms_enabled()

Usage Example

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 参考手册PyTorch torch Reference Manual

Other Extensions