Technology Document Guide of TensorRT
Technology Document Guide of TensorRT
Abstract
本示例支持指南概述了GitHub和產(chǎn)品包中包含的所有受支持的TensorRT 7.2.1示例。TensorRT示例在推薦程序、機器翻譯、字符識別、圖像分類和對象檢測等領(lǐng)域有特殊幫助。 有關(guān)TensorRT開發(fā)文檔,請參閱TensorRT歸檔文件。
- Introduction
下面的示例展示了如何在許多用例中使用TensorRT,同時突出顯示接口的不同功能。
1.1. Getting Started With C++ Samples
You can find the C++ samples in the
/usr/src/tensorrt/samples package directory as well as on GitHub. The following C++ samples are shipped with TensorRT.
“Hello World” For TensorRT Building A Simple MNIST Network Layer By Layer Importing The TensorFlow Model And Running Inference “Hello World” For TensorRT From ONNX Building And Running GoogleNet In TensorRT
Building An RNN Network Layer By Layer Performing Inference In INT8 Using Custom Calibration Performing Inference In INT8 Precision Adding A Custom Layer To Your Network In TensorRT Object Detection With Faster R-CNN
Object Detection With A TensorFlow SSD Network Movie Recommendation Using Neural Collaborative Filter (NCF)
Movie Recommendation Using MPS (Multi-Process Service)
Object Detection With SSD
“Hello World” For Multilayer Perceptron (MLP)
Specifying I/O Formats Using The Reformat Free I/O APIs Adding A Custom Layer That Supports INT8 I/O To Your Network In TensorRT Digit Recognition With Dynamic Shapes In TensorRT Neural Machine Translation (NMT) Using A Sequence To Sequence (seq2seq) Model Object Detection And Instance Segmentation With A TensorFlow Mask R-CNN Network Object Detection With A TensorFlow Faster R-CNN NetworkAlgorithm Selection API Usage Example Based On sampleMNIST In TensorRT1
Getting Started With C++ Samples
每個C++樣本包括一個GitHub中的README.md文件,該文件提供有關(guān)示例如何工作的詳細信息、示例代碼以及有關(guān)如何運行和驗證其輸出的分步說明。
Running C++ Samples on Linux
如果使用Debian文件安裝TensorRT,在構(gòu)建C++示例之前,首先復制/usr/src/tensorrt到新目錄。如果使用tar文件安裝了TensorRT,那么示例位于{TAR_EXTRACT_PATH}/samples中。要生成所有示例,然后運行其中一個示例,請使用以下命令:
$ cd <samples_dir>
$ make -j4
$ cd …/bin
$ ./<sample_bin>
Running C++ Samples on Windows
Windows上的所有C++樣本都作為VisualStudio解決方案文件提供。若要生成示例,請打開其相應的VisualStudio解決方案文件并生成解決方案。輸出可執(zhí)行文件將在(ZIP_EXTRACT_PATH)\bin中生成。然后可以直接或通過visual studio運行可執(zhí)行文件。
1.2. Getting Started With Python Samples
可以在 /usr/src/tensorrt/samples/python包目錄中找到Python示例。以下Python示例隨TensorRT一起提供。
Introduction To Importing Caffe, TensorFlow And ONNX Models Into TensorRT Using Python “Hello World” For TensorRT Using TensorFlow And Python “Hello World” For TensorRT Using PyTorch And Python Adding A Custom Layer To Your TensorFlow Network In TensorRT In Python Object Detection With The ONNX TensorRT Backend In Python Object Detection With SSD In Python INT8 Calibration In Python Refitting An Engine In Python TensorRT Inference Of ONNX Models With Custom Layers In Python
Getting Started With Python Samples
每個Python示例都包含README.md文件。請參閱
/usr/src/tensorrt/samples/python//README.md文件獲取有關(guān)示例如何工作的詳細信息、示例代碼以及有關(guān)如何運行和驗證其輸出的分步說明。
Running Python Samples
要運行其中一個Python示例,該過程通常包括兩個步驟:
Install the sample requirements:
- python -m pip install -r requirements.txt
where python is either python2 or python3.
Run the sample code with the data directory provided if the TensorRT sample data is not in the default location. For example:
python sample.py [-d DATA_DIR]
For more information on running samples, see the README.md file included with the sample.
總結(jié)
以上是生活随笔為你收集整理的Technology Document Guide of TensorRT的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python API vs C++ AP
- 下一篇: Recommenders with Te