fix: Bugfix in TRT Engine deserialization indexing by gs-olive · Pull Request #1646 · pytorch/TensorRT (original) (raw)

Description

The IO Tensors and Bindings within the TensorRT ICudaEngine object are not necessarily stored in index-order, or in the order they are stored in PyTorch. Thus, one of the checks in the TRTEngine which extracts the TRT binding name and compares it to the Torch binding name is unnecessary/incorrect and can be improved.

As an example, consider an engine with two inputs: {“input_0”, “input_1”} and two outputs {“output_0”, “output_1”}. The Torch binding names (c10::NameList) stores these as:

[“input_0”, “input_1”, “output_0”, “output_1”]

The TRT Engine binding buffer stores these names as:

[“input_0”, “input_1”, “output_1”, “output_0”]

Thus, when we use direct indexing to access the binding names, an error is encountered, despite the fact that the overall set of IO tensors is the same.

Fixes #1550
Fixes #1645

Type of change

Checklist: