# Tensorrt inference slower than tensorflow

**URL:** <https://forums.developer.nvidia.com/t/tensorrt-inference-slower-than-tensorflow/159981>\
**Category:** TensorRT\
**Created:** [November 19, 2020, 3:44pm UTC](https://forums.developer.nvidia.com/t/tensorrt-inference-slower-than-tensorflow/159981 "2020-11-19T15:44:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![awatef.edhib](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@awatef.edhib](https://forums.developer.nvidia.com/u/awatef.edhib)\
**Post date:** [November 19, 2020, 3:44pm UTC](https://forums.developer.nvidia.com/t/tensorrt-inference-slower-than-tensorflow/159981/1 "2020-11-19T15:44:15Z")

</div>

## Description

i created a engine (.pb\>.onnx\>.plan) , however inference time is slower than inference using tensorflow model (.pb)

## Environment

XAVIER  
**TensorRT Version** : 5.1.6  
**CUDA Version** : 10.0  
**CUDNN Version** : 7.5.0  
**Operating System + Version** :  
**Python Version** : 3.6  
**TensorFlow Version** : 1.14.0

---

<div class="post-metadata">

**Author:** ![AakankshaS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aakankshas/32/14047_2.png) [@AakankshaS](https://forums.developer.nvidia.com/u/AakankshaS)\
**Post date:** [November 20, 2020, 5:29am UTC](https://forums.developer.nvidia.com/t/tensorrt-inference-slower-than-tensorflow/159981/3 "2020-11-20T05:29:11Z")

</div>

Hi @awatef.edhib  
We recommend you to try the latest TRT release for improved performances.  
[https://developer.nvidia.com/nvidia-tensorrt-7x-download](https://developer.nvidia.com/nvidia-tensorrt-7x-download)

> **[TensorRT | NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tensorrt)**
>
> NVIDIA TensorRT is a C++ library that facilitates high-performance inference on NVIDIA graphics processing units (GPUs). TensorRT takes a trained network and produces a highly optimized runtime engine that performs inference for that network.

Thanks!

---

<div class="post-metadata">

**Author:** ![awatef.edhib](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@awatef.edhib](https://forums.developer.nvidia.com/u/awatef.edhib)\
**Post date:** [November 20, 2020, 1:17pm UTC](https://forums.developer.nvidia.com/t/tensorrt-inference-slower-than-tensorflow/159981/4 "2020-11-20T13:17:02Z")

</div>

thanks for your reply  
the problem is that the vector of the characteristics (of image) resulting from the engine is of size 73984 which takes a lot of time when calculating the distance between 2 vectors. on the other hand the vector resulting from tf model is of size 512

---

<div class="post-metadata">

**Author:** ![AakankshaS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aakankshas/32/14047_2.png) [@AakankshaS](https://forums.developer.nvidia.com/u/AakankshaS)\
**Post date:** [November 27, 2020, 8:37am UTC](https://forums.developer.nvidia.com/t/tensorrt-inference-slower-than-tensorflow/159981/5 "2020-11-27T08:37:00Z")

</div>

Hi @awatef.edhib,  
TRT 5 is an old release and may have performance issues, hence we suggest you to try the latest TRT release.  
If the issue persist, we request you to share your model and script so that we can elp you further.

Thanks!
