Shortcuts

torch_tensorrt.logging

class torch_tensorrt.logging.Level(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: 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() 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

Level

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: Level, msg: str) None[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 (Level) – Severity of the message

  • msg (str) – Actual message text

torch_tensorrt.logging.set_is_colored_output_on(colored_output_on: bool) None[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) None[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: Level) None[source]

Set the level required for a message to be printed to the log

Parameters

level (Level) – The enum representing the level required to print

class torch_tensorrt.logging.warnings[source]

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)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources