torch.is_warn_always_enabled
function is_warn_always_enabled(): booleanCheck if "always warn" mode is currently enabled.
Queries whether all warnings are being logged, or only selected warnings. Use this to check your current warning configuration or adjust behavior accordingly.
- Query-only: Does not change any settings
- Default: Returns false unless
set_warn_always(true)was called - Global: Returns the global setting that applies to all warnings
Returns
boolean– true if always-warn is enabled, false if following normal warning rulesExamples
// Check warning mode
if (torch.is_warn_always_enabled()) {
console.log('Verbose warnings enabled');
} else {
console.log('Normal warning mode');
}
// Conditionally enable verbose mode for testing
if (process.env.DEBUG) {
torch.set_warn_always(true);
}
// Verify verbose mode is on before debugging
if (!torch.is_warn_always_enabled()) {
console.warn('Consider enabling always-warn for debugging');
}See Also
- PyTorch torch.is_warn_always_enabled()
- set_warn_always - Enable/disable always-warn
- set_deterministic_debug_mode - Set determinism warning level