Metadata-Version: 2.1
Name: trtutils
Version: 0.0.5
Author-email: Justin Davis <davisjustin302@gmail.com>
Maintainer-email: Justin Davis <davisjustin302@gmail.com>
Project-URL: Homepage, https://github.com/justincdavis/trtutils
Project-URL: Bug Tracker, https://github.com/justincdavis/trtutils/issues
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Natural Language :: English
Classifier: Topic :: System :: Hardware
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Embedded Systems
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Hardware
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: End Users/Desktop
Classifier: Typing :: Typed
Requires-Python: <=3.13,>=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tensorrt>=8.0.0
Requires-Dist: pycuda>=2024.0
Requires-Dist: numpy<2.0.0,>=1.19.0
Requires-Dist: typing_extensions>=4.0.0
Requires-Dist: setuptools>=57.0.0
Provides-Extra: ci
Requires-Dist: pyupgrade>=3.10; extra == "ci"
Requires-Dist: black>=24.0; extra == "ci"
Requires-Dist: isort>=5.10; extra == "ci"
Requires-Dist: ruff>=0.2.2; extra == "ci"
Requires-Dist: mypy>=1.8.0; extra == "ci"
Requires-Dist: types-setuptools>=57.0.0; extra == "ci"
Provides-Extra: test
Requires-Dist: pytest>=6.2.0; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx>=6.1.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
Requires-Dist: myst_parser>=1.0.0; extra == "docs"
Provides-Extra: dev
Requires-Dist: trtutils[ci]; extra == "dev"
Requires-Dist: trtutils[test]; extra == "dev"
Requires-Dist: trtutils[docs]; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: wheel>=0.37.0; extra == "dev"
Requires-Dist: bumpver>=2023.1126; extra == "dev"
Requires-Dist: pyclean>=2.7.0; extra == "dev"
Requires-Dist: pyright>=1.1.348; extra == "dev"

# trtutils

[![](https://img.shields.io/pypi/pyversions/trtutils.svg)](https://pypi.org/pypi/trtutils/)
![PyPI](https://img.shields.io/pypi/v/trtutils.svg?style=plastic)

![MyPy](https://github.com/justincdavis/trtutils/actions/workflows/mypy.yaml/badge.svg?branch=main)
![Ruff](https://github.com/justincdavis/trtutils/actions/workflows/ruff.yaml/badge.svg?branch=main)
![Black](https://github.com/justincdavis/trtutils/actions/workflows/black.yaml/badge.svg?branch=main)
![PyPi Build](https://github.com/justincdavis/trtutils/actions/workflows/build-check.yaml/badge.svg?branch=main)

Utilities for enabling easier high-level usage of TensorRT in Python.

## TRTEngine
The TRTEngine is a high-level abstraction allowing easy use of TensorRT 
engines through Python. Once an engine is built, it is simple and easy to use:

```python
from trtutils import TRTEngine

engine = TRTEngine("path_to_engine")

inputs = read_your_data()

for i in inputs:
    print(engine.execute(i))
```

We also provide an abstraction for defining higher-level models.
The TRTModel is designed to allow a user to define a pre and post 
processing step along with the engine to create an end-to-end 
inference object.

```python
from trtutils import TRTModel

# scale some images down
def pre(inputs):
    return [i / 255 for i in inputs]

# access the output classes from object detection
def post(outputs):
    return [o[0][0] for o in outputs]

model = TRTModel("path_to_engine", pre, post)

inputs = read_your_data()

for i in inputs:
    print(model(i))
```
