torch_tensorrt.logging¶
- class torch_tensorrt.logging.Level(value)[source]¶
Bases:
enum.Enum
Enum to set the minimum required logging level to print a message to stdout
- Debug = <LogLevel.DEBUG: 4>¶
- Error = <LogLevel.ERROR: 1>¶
- Graph = <LogLevel.GRAPH: 5>¶
- Info = <LogLevel.INFO: 3>¶
- InternalError = <LogLevel.INTERNAL_ERROR: 0>¶
- Warning = <LogLevel.WARNING: 2>¶
- class torch_tensorrt.logging.debug[source]¶
Bases:
object
Context-manager to display full debug information through the logger
Example:
- with torch_tensorrt.logging.debug():
model_trt = torch_tensorrt.compile(model, **spec)
- class torch_tensorrt.logging.errors[source]¶
Bases:
object
Context-manager to limit displayed log messages to just errors and above
Example:
- with torch_tensorrt.logging.errors():
outputs = model_torchtrt(inputs)
- torch_tensorrt.logging.get_is_colored_output_on() bool [source]¶
Get if colored output is enabled for logging
- Returns
If colored output is one
- Return type
bool
- torch_tensorrt.logging.get_logging_prefix() str [source]¶
Get the prefix set for logging messages
- Returns
Prefix used for logger
- Return type
str
- torch_tensorrt.logging.get_reportable_log_level() torch_tensorrt.logging.Level [source]¶
Get the level required for a message to be printed in the log
- Returns
The enum representing the level required to print
- Return type
- class torch_tensorrt.logging.graphs[source]¶
Bases:
object
Context-manager to display the results of intermediate lowering passes as well as full debug information through the logger
Example:
- with torch_tensorrt.logging.graphs():
model_trt = torch_tensorrt.compile(model, **spec)
- class torch_tensorrt.logging.info[source]¶
Bases:
object
Context-manager to display all info and greater severity messages
Example:
- with torch_tensorrt.logging.info():
model_trt = torch_tensorrt.compile(model, **spec)
- class torch_tensorrt.logging.internal_errors[source]¶
Bases:
object
Context-manager to limit displayed log messages to just internal errors
Example:
- with torch_tensorrt.logging.internal_errors():
outputs = model_torchtrt(inputs)
- torch_tensorrt.logging.log(level: torch_tensorrt.logging.Level, msg: str)[source]¶
Add a new message to the log
Adds a new message to the log at a specified level. The message will only get printed out if Level > reportable_log_level
- Parameters
level (torch_tensorrt.logging.Level) – Severity of the message
msg (str) – Actual message text
- torch_tensorrt.logging.set_is_colored_output_on(colored_output_on: bool)[source]¶
Enable or disable color in the log output
- Parameters
colored_output_on (bool) – If colored output should be enabled or not
- torch_tensorrt.logging.set_logging_prefix(prefix: str)[source]¶
Set the prefix used when logging messages
- Parameters
prefix (str) – Prefix to use for logging messages
- torch_tensorrt.logging.set_reportable_log_level(level: torch_tensorrt.logging.Level)[source]¶
Set the level required for a message to be printed to the log
- Parameters
level (torch_tensorrt.logging.Level) – The enum representing the level required to print