1 Star 0 Fork 0

jianfeng/TensorRT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

TensorRT Python Bindings

Installation

Download pybind11

Create a directory for external sources and download pybind11 into it.

export EXT_PATH=~/external

mkdir -p $EXT_PATH && cd $EXT_PATH
git clone https://github.com/pybind/pybind11.git -b v2.6.2

Download Python headers

Add Main Headers

  1. Get the source code from the official python sources
  2. Copy the contents of the Include/ directory into $EXT_PATH/pythonX.Y/include/ directory.

Add PyConfig.h

  1. Download the deb package for the desired platform from here. Typical plaforms include x86_64 (amd64), aarch64 (arm64), and ppc64le (ppc64el)
  2. Unpack the debian with ar x <libpython...>.deb
  3. Unpack the contained data.tar.xz with tar -xvf
  4. Copy the ./usr/include/<platform>/ directory into the $$EXT_PATH/pythonX.Y/include/ directory here. It should only contain a single file - pyconfig.h

Build Python bindings

Use build.sh to generate the installable wheels for intended python version and target architecture.

Example: for python 3.8 x86_64 wheel,

cd $TRT_OSSPATH/python
PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=8 TARGET_ARCHITECTURE=x86_64 ./build.sh

Install the python wheel

python3 -m pip install build/dist/tensorrt-*.whl
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/ivofeng/TensorRT.git
git@gitee.com:ivofeng/TensorRT.git
ivofeng
TensorRT
TensorRT
main

搜索帮助