Skip to content

Lock all dependencies to exact versions for reproducible ONNX graph generation#5

Merged
runwangdl merged 7 commits intopulp-platform:develfrom
runwangdl:dependency
Feb 19, 2026
Merged

Lock all dependencies to exact versions for reproducible ONNX graph generation#5
runwangdl merged 7 commits intopulp-platform:develfrom
runwangdl:dependency

Conversation

@runwangdl
Copy link
Collaborator

Summary

Different environments (e.g., different versions of torch, onnx, onnxscript, etc.)
produce different ONNX graph structures, making cross-environment reproducibility impossible.
This PR pins all core dependencies to the exact versions used in the reference environment
to guarantee identical ONNX graph generation regardless of where the code is run.

Changes

  • requirements.txt: Replace all range constraints (>=, <) with exact version pins (==)
  • pyproject.toml: Same pinning in dependencies; narrow requires-python from >=3.9 to ==3.10.*

Pinned Environment

Package Version
Python 3.10.12
torch 2.7.0
onnx 1.16.0
onnx-graphsurgeon 0.5.8
onnxruntime-training 1.19.2
onnxscript 0.5.7
onnxsim 0.4.36
numpy 1.26.4
pyyaml 6.0.2

Motivation

ONNX graph generation is sensitive to library internals (operator fusion, constant folding,
node ordering, opset handling, etc.). Allowing version ranges silently permits environment
drift that produces structurally different graphs — breaking downstream deployment pipelines
that rely on a stable graph topology.

Impact

Installing in an environment that does not match these exact versions will now fail
explicitly
rather than silently producing a divergent ONNX graph.

runwangdl and others added 7 commits February 14, 2026 15:53
This commit adds support for the ONNX Sub (subtraction) operator:

- Created SubOperatorTest class in onnx4deeploy/operators/sub.py
  * Implements element-wise binary subtraction (A - B)
  * Supports Numpy-style broadcasting
  * Based on ONNX Opset 14 specification
  * Uses SimpleElementwiseOperator base class

- Registered Sub operator in onnx4deeploy/operators/__init__.py

- Added default configuration in onnx4deeploy/operators/config.yaml
  * Default input shape: [1, 64, 32, 32] (NCHW format)
  * Opset version: 14

- Added comprehensive pytest tests in tests/operators/test_operators.py
  * test_sub_basic: Verifies basic functionality
  * test_sub_different_shapes: Tests multiple input shapes
  * test_sub_result_range: Validates output range correctness
  * All tests passing ✓

Generated test files validated:
- network.onnx: Sub operator graph
- inputs.npz: Two input tensors (input_a, input_b)
- outputs.npz: Expected output (A - B)
- Numerical verification: max difference = 0.000000e+00

Reference: https://onnx.ai/onnx/operators/onnx__Sub.html

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@runwangdl runwangdl merged commit 2d45722 into pulp-platform:devel Feb 19, 2026
4 checks passed
@runwangdl runwangdl deleted the dependency branch February 19, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant