trtutils.inspect package

Module contents

Submodule containing tools for inspecting TensorRT engines.

Functions

get_engine_names()

Get the input/output names of a TensorRT engine in order.

inspect_engine()

Inspect a TensorRT engine.

trtutils.inspect.get_engine_names(engine: Path | str | ICudaEngine) tuple[list[str], list[str]][source]

Get the input/output names of a TensorRT engine in order.

Parameters:

engine (Path | str | trt.ICudaEngine) – Path to the TensorRT engine file or an already loaded engine

Returns:

The input and output tensors in order of enumeration.

Return type:

tuple[list[str], list[str]]

trtutils.inspect.inspect_engine(engine: Path | str | ICudaEngine, *, verbose: bool | None = None) tuple[int, int, list[tuple[str, tuple[int, ...], DataType, TensorFormat]], list[tuple[str, tuple[int, ...], DataType, TensorFormat]]][source]

Inspect a TensorRT engine.

Parameters:
  • engine (Path | str | trt.ICudaEngine) – Path to the TensorRT engine file or an already loaded engine

  • verbose (bool | None, optional) – Whether to print verbose output, by default None

Returns:

The size in bytes of the engine, the max batch size, and two lists of input and output tensors

Return type:

tuple[int, int, list[tuple[str, tuple[int, …], trt.DataType, trt.TensorFormat]], list[tuple[str, tuple[int, …], trt.DataType, trt.TensorFormat]]]