PyTorch
Loading...
Searching...
No Matches
Classes | Functions
c10::WarningUtils Namespace Reference

Classes

struct  WarnAlways
 
class  WarningHandlerGuard
 

Functions

void set_warning_handler (WarningHandler *handler) noexcept(true)
 Sets the global warning handler. More...
 
WarningHandlerget_warning_handler () noexcept(true)
 Gets the global warning handler. More...
 
void set_warnAlways (bool) noexcept(true)
 The TORCH_WARN_ONCE macro is difficult to test for. More...
 
bool get_warnAlways (void) noexcept(true)
 

Function Documentation

◆ get_warnAlways()

bool c10::WarningUtils::get_warnAlways ( void  )
noexcept

◆ get_warning_handler()

WarningHandler * c10::WarningUtils::get_warning_handler ( )
noexcept

Gets the global warning handler.

◆ set_warnAlways()

void c10::WarningUtils::set_warnAlways ( bool  )
noexcept

The TORCH_WARN_ONCE macro is difficult to test for.

Use setWarnAlways(true) to turn it into TORCH_WARN, which can be tested for more easily.

◆ set_warning_handler()

void c10::WarningUtils::set_warning_handler ( WarningHandler handler)
noexcept

Sets the global warning handler.

This is not thread-safe, so it should generally be called once during initialization or while holding the GIL for programs that use python. User is responsible for keeping the WarningHandler alive until it is not needed.