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

PyTorch torch.set_deterministic_debug_mode function

PyTorch torch.set_deterministic_debug_mode function


PyTorch torch reference manual PyTorch torch reference manual

torch.set_deterministic_debug_mode is a function in PyTorch used to set the deterministic debug mode. When set to a nonzero value, PyTorch raises an error or warning when nondeterministic algorithms are used.

Function definition

torch.set_deterministic_debug_mode(debug_mode)

Parameter Description

- `0`: off (default) - `1`: enable strict mode - `2`: enable warning mode

Usage examples

Example

import

torch

Set the deterministic debug mode to strict

This raises an error when nondeterministic operations are used

torch.

set_deterministic_debug_mode

(

1

)

Set to warning mode

torch.

set_deterministic_debug_mode

(

2

)

Turn off debug mode

torch.

set_deterministic_debug_mode

(

0

)

print

(

"Deterministic debug mode set"

)

The output is:

确定性调试模式已设置


PyTorch torch reference manual PyTorch torch reference manual