torch.get_deterministic_debug_mode
function get_deterministic_debug_mode(): numberGet the current debug verbosity level for deterministic algorithm violations.
Queries the global configuration to see what debug mode is currently set. Useful for conditional behavior or verification.
Return Values:
- 0: Default/silent mode (no warnings)
- 1: Warning mode (logs warnings)
- 2: Error mode (throws exceptions)
- Query-only: Does not change any settings
- Default: Returns 0 unless
set_deterministic_debug_mode()was called - Works with determinism: Most relevant when deterministic mode is enabled
Returns
number– Current debug mode (0, 1, or 2)Examples
// Check current debug mode
const mode = torch.get_deterministic_debug_mode();
console.log(`Debug mode: ${mode}`);
// Conditional behavior based on debug mode
if (torch.get_deterministic_debug_mode() === 2) {
console.log('Running in strict error mode');
}
// Verify debug settings before running expensive operations
const debugMode = torch.get_deterministic_debug_mode();
if (debugMode === 0) {
console.warn('Debug mode is off - set to 1 or 2 for safety');
}See Also
- PyTorch torch.get_deterministic_debug_mode()
- set_deterministic_debug_mode - Set debug mode
- use_deterministic_algorithms - Enable deterministic execution