YouTip LogoYouTip

Pytorch Torch Set_Deterministic_Algorithm_Enabled

# PyTorch torch.set_deterministic_algorithm_enabled Function * * * [![Image 3: Pytorch torch Reference Manual](https://example.com/images/up.gif) Pytorch torch Reference Manual](https://example.com/pytorch/pytorch-torch-ref.html) `torch.set_deterministic_algorithm_enabled` is a function in PyTorch used to set deterministic algorithms. It sets whether to enable deterministic algorithms; after enabling, each run will produce the same results. ### Function Definition torch.set_deterministic_algorithm_enabled(enabled, mode='warn') * * * ## Usage Example ## Example import torch # Enable deterministic algorithm torch.set_deterministic_algorithm_enabled(True) # Check if enabled print(f"Is deterministic: {torch.are_deterministic_algorithms_enabled()}") # Disable deterministic algorithm torch.set_deterministic_algorithm_enabled(False) print(f"Is deterministic: {torch.are_deterministic_algorithms_enabled()}") * * * [![Image 4: Pytorch torch Reference Manual](https://example.com/images/up.gif) Pytorch torch Reference Manual](https://example.com/pytorch/pytorch-torch-ref.html)
← Pytorch Torch Set_Grad_EnabledPytorch Torch Select_Scatter β†’