SOURCES + EXPLANATION:
- https://github.com/daquexian/onnx-simplifier
- https://github.com/onnx/onnx-tensorrt/blob/main/docs/faq.md
- Why use
surgeon sanitize
: https://github.com/NVIDIA/TensorRT/tree/main/tools/Polygraphy/examples/cli/surgeon/02_folding_constants - Optional: https://github.com/NVIDIA/TensorRT/tree/master/tools/onnx-graphsurgeon/examples
- Explain optShapes : https://elinux.org/TensorRT/ONNX (Ctrl + F to find)
REQUIREMENTS:
python3 -m pip install onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com
pip install onnxsim colored
polygraphy surgeon sanitize --fold-constants <onnx_file> -o <output_onnx_file>
onnxsim <onnx_file> <output_onnx_file>