skillfed

sio4onnx

Simple tool to change the INPUT and OUTPUT shape of ONNX.

sio4onnx v1.0.3 82.8K downloads/30d#14,137 on PyPI15
Permissive license MIT License AGING released

What it is and what it does

sio4onnx is a lightweight utility for modifying the declared input and output shapes of ONNX model files. It works both as a command-line tool and as a Python library, accepting either a file path or an in-memory ONNX graph, then rewriting the shape metadata for specified input and output nodes. You can use fixed dimensions, symbolic names like 'H' and 'W', or dynamic markers like '-1' to represent variable axes.

The package is useful when you have a pre-trained ONNX model with fixed shapes but need to adapt it for different batch sizes, image resolutions, or sequence lengths without retraining. It modifies only the shape declarations in the model graph, not the underlying weights or operations. The tool has no external runtime dependencies and supports Python 3.6 and later, making it straightforward to integrate into model preprocessing pipelines.

Use it for:

  • Adapt a fixed-batch ONNX model to accept variable batch sizes for inference on different hardware or deployment scenarios.
  • Change image input dimensions in a computer vision model to match production inference requirements.
  • Prepare an ONNX model for deployment on edge devices by modifying input shapes to match device constraints.
  • Batch-process multiple ONNX files to standardize their input/output shape signatures across a model zoo.
  • Use symbolic dimension names in place of hard-coded values to enable downstream tools to infer shapes dynamically.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Modifies the input and output shapes of ONNX model files, allowing you to adapt pre-trained models to different batch sizes, dimensions, or symbolic shape parameters via CLI or Python API.

Yes, if you work with ONNX models and need to adjust their input/output shapes for deployment or inference. The package is lightweight, dependency-free, and permissively licensed. Maintenance is aging (last release 500 days ago), but the repository is not archived and the tool solves a narrow, stable problem unlikely to require frequent updates. Suitable for production use in model preprocessing pipelines.

Install

sio4onnx on PyPI

pip

pip install sio4onnx

uv

uv add sio4onnx

poetry

poetry add sio4onnx

Installing sio4onnx

Before you install

Installs cleanly with no runtime dependencies. Maintenance is aging—last release was 500 days ago—but the repository remains active and the package supports current Python versions.

License in practice

MIT License permits commercial and private use with minimal restrictions, making it safe to integrate into proprietary workflows.

Quickstart

pip install sio4onnx

from sio4onnx import io_change

io_changed_graph = io_change(
    input_onnx_file_path="model.onnx",
    output_onnx_file_path="model_reshaped.onnx",
    input_names=["input_1"],
    input_shapes=[[1, 3, "H", "W"]],
    output_names=["output_1"],
    output_shapes=[[1, "boxes", 4]]
)

Verify before relying

  • Whether symbolic dimension names are fully preserved through inference pipelines downstream.
  • Support for dynamic shape inference or validation after modification.
  • Compatibility with all ONNX opset versions or any known limitations.

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 aging — 500 days since the last release
Last repo commit
First released
Downloads 82,754/month — #14,137 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sio4onnx-1.0.3-py3-none-any.whl

Tags

onnx model shape modificationchange onnx input output dimensionsonnx batch size adjustmentreshape onnx modelonnx io shape editoradapt onnx model dimensionsonnx symbolic shape parameters
onnx-toolsmodel-preprocessing

More Artificial Intelligence packages