TensorRT2ONNX
A tool convert TensorRT engine/plan to a fake onnx
Build an engine from onnx using trtexec tools
trtexec --verbose \
--nvtxMode=verbose \
--buildOnly \
--workspace=8192 \
--onnx=your_onnx.onnx \
--saveEngine=your_engine.engine \
--timingCacheFile=timing.cache \
--fp16 # use fp16
You will get a your_engine.engine and a timing.cache
Parser network from engine using trtexec tools
trtexec --verbose \
--noDataTransfers \
--useCudaGraph \
--separateProfileRun \
--useSpinWait \
--nvtxMode=verbose \
--loadEngine=your_engine.engine \
--exportLayerInfo=graph.json \
--timingCacheFile=timing.cache
You will parser your_engine.engine network information into graph.json
Install TensorRT2ONNX
pip3 install trt2onnx -i https://pypi.org/simple
Build a fake onnx from graph json
import onnx
from trt2onnx import build_onnx
# build a fake onnx from json
onnx_graph = build_onnx('graph.json')
# save the fake onnx as `fake.onnx`
onnx.save(onnx_graph, 'fake.onnx')
Build a fake onnx from engine
import onnx
from trt2onnx import build_onnx
# build a fake onnx from engine
onnx_graph = build_onnx('your_engine.engine')
# save the fake onnx as `fake.onnx`
onnx.save(onnx_graph, 'fake.onnx')
NOTICE !!
If you build engine use your own plugin,
please load the *.so before build_onnx function.
import ctypes
# load your plugin first
ctypes.cdll.LoadLibrary('your_plugin_0.so')
ctypes.cdll.LoadLibrary('your_plugin_1.so')
...
Use Netron to view your fake onnx
Metadata
Release files for trt2onnx 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trt2onnx-0.0.2.tar.gz | 10.0 kB | Without provenance | Details for trt2onnx-0.0.2.tar.gz |
Release files / trt2onnx-0.0.2.tar.gz
| Download URL | trt2onnx-0.0.2.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21e00faef4cf232532692b701c69fed685255318d314c0535decdbad74b78c58
|
|
BLAKE2b-256 checksum How to use checksums |
2c3e8a1cd166f3a5823dd6c541ea7d09090423ab41a721f267d0408c308d59f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Security for trt2onnx 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.