Simple node deletion tool for onnx.
Project description
snd4onnx
Simple node deletion tool for onnx. I only test very miscellaneous and limited patterns as a hobby. There are probably a large number of bugs. Pull requests are welcome.
1. Setup
### option
$ echo export PATH="~/.local/bin:$PATH" >> ~/.bashrc \
&& source ~/.bashrc
### run
$ pip install -U onnx \
&& python3 -m pip install -U onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com \
&& pip install -U snd4onnx
2. CLI Usage
$ snd4onnx -h
usage:
snd4onnx [-h]
--onnx_file_path ONNX_FILE_PATH
--remove_node_names REMOVE_NODE_NAMES [REMOVE_NODE_NAMES ...]
optional arguments:
-h, --help
show this help message and exit
--onnx_file_path ONNX_FILE_PATH
Input onnx file path.
--remove_node_names REMOVE_NODE_NAMES [REMOVE_NODE_NAMES ...]
ONNX node name to be deleted.
3. In-script Usage
>>> from snd4onnx import remove
>>> help(remove)
Help on function remove in module snd4onnx.onnx_remove_node:
remove(onnx_file_path: str, remove_node_names: List[str])
Parameters
----------
onnx_file_path: str
Input onnx file paths.
remove_node_names: List[str]
List of OP names to be deleted.
e.g. remove_node_names = ['op_name1', 'op_name2', 'op_name3', ...]
4. CLI Execution
$ snd4onnx \
--onnx_file_path input.onnx \
--remove_node_names node_name_a node_name_b
5. In-script Execution
from snd4onnx import remove
remove(
onnx_file_path='input.onnx',
remove_node_names=['node_name_a', 'node_name_b'],
)
6. Sample
6-1. sample.1
Before | After |
---|---|
6-2. sample.2
Before | After |
---|---|
6-3. sample.3
Before | After |
---|---|
6-4. sample.4
Before | After |
---|---|
6-5. sample.5
Before | After |
---|---|
7. Reference
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
snd4onnx-1.1.0.tar.gz
(8.8 kB
view hashes)