sog4onnx
Simple ONNX operation generator. Simple Operation Generator for ONNX.
What it is and what it does
sog4onnx is a command-line and Python library tool for generating single ONNX operations with user-specified inputs, outputs, and attributes. It deliberately skips consistency checking of operation definitions, allowing it to adapt as ONNX's opset evolves without requiring updates. The tool is designed as a building block: you define one operation at a time, then combine multiple generated operations using companion tools to construct complete ONNX graphs.
The package supports both CLI and in-script usage, accepting operation type, opset version, IR version, variable names and shapes, and operation-specific attributes. It outputs either a Python ModelProto object or a serialized .onnx file. Because it performs no validation, you must consult the ONNX operator documentation to ensure your inputs and attributes are correct for the operation you're generating.
Use it for:
- Generate a single ONNX Gemm operation with custom input shapes and attributes for matrix multiplication.
- Create minimal ONNX graphs for testing or prototyping new operation combinations before building full models.
- Build operation definitions programmatically when constructing dynamic ONNX graphs from external specifications.
- Generate Add, NonMaxSuppression, or other standard operations with precise control over tensor shapes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates minimal ONNX operation graphs by specifying operation type, inputs, outputs, and attributes without external runtime dependencies.
Yes, if you need to generate individual ONNX operations programmatically or via CLI and plan to combine them with companion tools. The low install friction and permissive MIT license make it a safe addition. However, dormant maintenance since April 2024 means you should verify compatibility with your target ONNX opset version before relying on it in production.
Install
sog4onnx on PyPI
pip
pip install sog4onnxuv
uv add sog4onnxpoetry
poetry add sog4onnxInstalling sog4onnx
Before you install
Low install friction; pure Python wheel with no runtime dependencies. Maintenance is dormant—last release was 836 days ago, though the repository remains active with a final commit in April 2024.
License in practice
MIT License permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install sog4onnx
from sog4onnx import generate
single_op_graph = generate(
op_type='Add',
opset=11,
ir_version=9,
op_name='add_op',
input_variables={'i1': [float, [1,2,3]], 'i2': [float, [1,2,3]]},
output_variables={'o1': [float, [1,2,3]]}
)
Verify before relying
- Whether the package handles validation of operation definitions against the ONNX specification version being used.
- Whether generated graphs can be directly used with ONNX Runtime or require post-processing via companion tools.
- Current compatibility with recent ONNX opset versions beyond the April 2024 release date.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 836 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 84,252/month — #14,012 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sog4onnx-1.0.17-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
sng4onnxAutomatically generates and assigns operation…
permissive · top 15,000 on PyPI
sna4onnxAdds new operations (nodes) to ONNX model…
permissive · top 15,000 on PyPI
sod4onnxsod4onnx removes specified output operations…
permissive · top 15,000 on PyPI
sam4onnxRewrites attributes and constants in ONNX model…
permissive · top 15,000 on PyPI
soa4onnxAdds or modifies output nodes in ONNX model…
permissive · top 15,000 on PyPI
onnx-graphsurgeonONNX GraphSurgeon lets you programmatically…
permissive · top 15,000 on PyPI
snd4onnxRemoves specified nodes from ONNX model graphs…
permissive · top 15,000 on PyPI
soc4onnxChanges the opset version of an ONNX model…
permissive · top 15,000 on PyPI
snc4onnxMerges multiple ONNX neural network models into…
permissive · top 15,000 on PyPI
onnxscriptWrite ONNX functions and models in Python…
permissive · top 5,000 on PyPI