torch_tensorrt.logging#

class torch_tensorrt.logging.debug[source]#

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]#

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

Example

with torch_tensorrt.logging.errors():
    outputs = model_torchtrt(inputs)
class torch_tensorrt.logging.graphs[source]#

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]#

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]#

Context-manager to limit displayed log messages to just internal errors

Example

with torch_tensorrt.logging.internal_errors():
    outputs = model_torchtrt(inputs)
class torch_tensorrt.logging.warnings[source]#

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)
torch_tensorrt.logging.set_level(level: int, logger: Any = None) None[source]#

Set log level for both Python and C++ torch_tensorrt loggers.

Permanently sets the log level until changed again or process exits. Automatically handles runtime availability checks.

This sets the log level for: - Specified Python logger (or root torch_tensorrt logger if None) - TorchScript frontend C++ logger (if available) - Dynamo runtime C++ logger (if available)

Parameters:
  • level – Python logging level (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)

  • logger – Optional logger to set level for. If None, sets the root torch_tensorrt logger.

Example

# Set debug logging for entire session torch_tensorrt.logging.set_level(logging.DEBUG)

# Or set for a specific logger my_logger = logging.getLogger(“torch_tensorrt.dynamo”) torch_tensorrt.logging.set_level(logging.DEBUG, logger=my_logger)