TensorRT 4.0 Python API Documentation¶
First, ensure that you have TensorRT 4.0 installed and accessible in your
LD_LIBRARY_PATH. You can find it here.
Installing the Python APIs¶
You can install the Python API using the wheels located in the
- Python 2.7:
pip2 install tensorrt-*_16.04-cp27-cp27mu-linux_x86_64.whl
- Python 3.5:
pip3 install tensorrt-*_16.04-cp35-cp35m-linux_x86_64.whl
tensorrt-* is the version you are installing (e.g.
Installing the Graph Surgeon¶
TensorRT includes the Graph Surgeon, which can transform TensorFlow graphs to ensure compatibility with the UFF converter. It can be used to specify plugin nodes for operations that might be unsupported in the UFF converter or TensorRT, and is required to handle certain TensorFlow ops. You can install it using the wheel located in the
pip install graphsurgeon-0.2.0-py2.py3-none-any.whl
Installing the UFF Toolkit¶
TensorRT includes the Universal Framework Format (UFF) toolkit, which can convert models trained in TensorFlow to a format from which TensorRT can build engines. You can install it using the wheel located in the
uff folder. Note that the UFF converter is only designed and tested for x86 platforms. To use TensorRT with UFF on other platforms, first generate the UFF file on an x86 platform.
pip install uff-0.4.0-py2.py3-none-any.whl
Use Cases and Examples¶
Running an existing TensorFlow model with TensorRT.
Running an existing Caffe model with TensorRT.
Manually constructing a TensorRT engine (for use with PyTorch, for example).
- Deploying a TensorRT engine as part of a larger application, such as a web backend.
We have included a few sample applications with the TensorRT Python package in the