Description
I have a conceptual question about layers like TopK, MaxPool etc. layers.
TopK is a layer which select the most K elements based on their values (Descending or Ascending).
And provide the values and their indices.
TensorRT engine, which built during the optimization process using tactics selection, will have a different tensors inputs values to these layers, compared to the Torch inputs values which will generate different tensors outputs, indices and values.
These kind of differences, which belongs to an intermediate layers, finally cause the final model output to be different.
It is true also if the TopK tensors inputs values gap (TensorRT Vs. Torch) is very very small for example e-10…
How shall I control this TopK tensors inputs gap in order to have the same intermediate tensors outputs in order to get a correct final model output?
Environment
TensorRT Version: 8.6.1.6
GPU Type: RTX 4090 mobile
Nvidia Driver Version: 546.24
CUDA Version: 12.3, V12.3.107
CUDNN Version: 8.9.7
Operating System + Version: Ubuntu 22.04.3 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64)
Python Version (if applicable): 3.10.12
TensorFlow Version (if applicable): NA
PyTorch Version (if applicable): 2.2.1+cu121
Baremetal or Container (if container which image + tag): Container - nvcr.io/nvidia/tensorrt:24.01-py3