torch_tensorrt.logging

class torch_tensorrt.logging. Level ( value )

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

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

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

Get if colored output is enabled for logging

Returns

If colored output is one

Return type

bool

torch_tensorrt.logging. get_logging_prefix ( ) str

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

Get the level required for a message to be printed in the log

Returns

The enum representing the level required to print

Return type

torch_tensorrt.logging.Level

class torch_tensorrt.logging. graphs

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

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

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 )

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
torch_tensorrt.logging. set_is_colored_output_on ( colored_output_on : bool )

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 )

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 )

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

class torch_tensorrt.logging. warnings

Bases: object

Context-manager to limit displayed log messages to just warnings and above

Example:

with torch_tensorrt.logging.warnings():

model_trt = torch_tensorrt.compile(model, ** spec)