onnxslim 0.1.74__tar.gz → 0.1.76__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {onnxslim-0.1.74/onnxslim.egg-info → onnxslim-0.1.76}/PKG-INFO +4 -3
- {onnxslim-0.1.74 → onnxslim-0.1.76}/README.md +2 -1
- onnxslim-0.1.76/VERSION +1 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/convbn.py +4 -4
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/symbolic_shape_infer.py +8 -3
- onnxslim-0.1.76/onnxslim/version.py +1 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76/onnxslim.egg-info}/PKG-INFO +4 -3
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim.egg-info/requires.txt +1 -1
- {onnxslim-0.1.74 → onnxslim-0.1.76}/setup.py +1 -1
- onnxslim-0.1.74/VERSION +0 -1
- onnxslim-0.1.74/onnxslim/version.py +0 -1
- {onnxslim-0.1.74 → onnxslim-0.1.76}/LICENSE +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/MANIFEST.in +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/__main__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/argparser.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/cli/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/cli/_main.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/optimization/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/optimization/dead_node_elimination.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/optimization/subexpression_elimination.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/optimization/weight_tying.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/elimination/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/elimination/concat.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/elimination/reshape.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/elimination/reshape_as.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/elimination/slice.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/elimination/unsqueeze.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/concat_reshape.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/convadd.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/convmul.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/gelu.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/gemm.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/padconv.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/fusion/reduce.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/core/pattern/registry.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/misc/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/misc/tabulate.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/_sympy/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/_sympy/functions.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/_sympy/numbers.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/_sympy/printers.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/_sympy/solve.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/_sympy/symbol.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/exporters/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/exporters/base_exporter.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/exporters/onnx_exporter.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/graph_pattern/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/graph_pattern/graph_pattern.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/importers/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/importers/base_importer.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/importers/onnx_importer.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/ir/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/ir/function.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/ir/graph.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/ir/node.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/ir/tensor.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/logger/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/logger/logger.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/util/__init__.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/util/exception.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/util/misc.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/utils.py +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim.egg-info/SOURCES.txt +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim.egg-info/dependency_links.txt +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim.egg-info/entry_points.txt +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim.egg-info/top_level.txt +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim.egg-info/zip-safe +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/pyproject.toml +0 -0
- {onnxslim-0.1.74 → onnxslim-0.1.76}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onnxslim
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.76
|
|
4
4
|
Summary: OnnxSlim: A Toolkit to Help Optimize Onnx Model
|
|
5
5
|
Home-page: https://github.com/inisis/OnnxSlim
|
|
6
6
|
Author: inisis
|
|
@@ -15,7 +15,7 @@ Requires-Python: >=3.6
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: onnx
|
|
18
|
-
Requires-Dist: sympy>=1.13.
|
|
18
|
+
Requires-Dist: sympy>=1.13.1
|
|
19
19
|
Requires-Dist: packaging
|
|
20
20
|
Requires-Dist: colorama
|
|
21
21
|
Requires-Dist: ml_dtypes
|
|
@@ -36,7 +36,7 @@ Dynamic: summary
|
|
|
36
36
|
|
|
37
37
|
<p align="center">
|
|
38
38
|
<a href="https://pypi.org/project/onnxslim">
|
|
39
|
-
<img src="https://
|
|
39
|
+
<img src="https://img.shields.io/pypi/v/onnxslim?color=blue" />
|
|
40
40
|
</a>
|
|
41
41
|
<a href="https://pypi.org/project/onnxslim">
|
|
42
42
|
<img src="https://static.pepy.tech/badge/onnxslim/week" />
|
|
@@ -131,6 +131,7 @@ For more usage, see onnxslim -h or refer to our [examples](./examples)
|
|
|
131
131
|
- <img src="https://avatars.githubusercontent.com/u/126587470?s=48&v=4" width="22" height="22"/>[deepghs/imgutils](https://github.com/deepghs/imgutils)
|
|
132
132
|
- <img src="https://avatars.githubusercontent.com/u/48153283?s=48&v=4" width="22" height="22"/>[sunsmarterjie/yolov12](https://github.com/sunsmarterjie/yolov12)
|
|
133
133
|
- <img src="https://avatars.githubusercontent.com/u/147458884?s=48&v=4" width="22" height="22"/>[nndeploy/nndeploy](https://github.com/nndeploy/nndeploy)
|
|
134
|
+
- <img src="https://avatars.githubusercontent.com/u/111754012?s=48&v=4" width="22" height="22"/>[CVCUDA/CV-CUDA](https://github.com/CVCUDA/CV-CUDA)
|
|
134
135
|
|
|
135
136
|
# References
|
|
136
137
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<a href="https://pypi.org/project/onnxslim">
|
|
5
|
-
<img src="https://
|
|
5
|
+
<img src="https://img.shields.io/pypi/v/onnxslim?color=blue" />
|
|
6
6
|
</a>
|
|
7
7
|
<a href="https://pypi.org/project/onnxslim">
|
|
8
8
|
<img src="https://static.pepy.tech/badge/onnxslim/week" />
|
|
@@ -97,6 +97,7 @@ For more usage, see onnxslim -h or refer to our [examples](./examples)
|
|
|
97
97
|
- <img src="https://avatars.githubusercontent.com/u/126587470?s=48&v=4" width="22" height="22"/>[deepghs/imgutils](https://github.com/deepghs/imgutils)
|
|
98
98
|
- <img src="https://avatars.githubusercontent.com/u/48153283?s=48&v=4" width="22" height="22"/>[sunsmarterjie/yolov12](https://github.com/sunsmarterjie/yolov12)
|
|
99
99
|
- <img src="https://avatars.githubusercontent.com/u/147458884?s=48&v=4" width="22" height="22"/>[nndeploy/nndeploy](https://github.com/nndeploy/nndeploy)
|
|
100
|
+
- <img src="https://avatars.githubusercontent.com/u/111754012?s=48&v=4" width="22" height="22"/>[CVCUDA/CV-CUDA](https://github.com/CVCUDA/CV-CUDA)
|
|
100
101
|
|
|
101
102
|
# References
|
|
102
103
|
|
onnxslim-0.1.76/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.76
|
|
@@ -36,21 +36,21 @@ class ConvBatchNormMatcher(PatternMatcher):
|
|
|
36
36
|
bn_bias = bn_node.inputs[2].values
|
|
37
37
|
bn_running_mean = bn_node.inputs[3].values
|
|
38
38
|
bn_running_var = bn_node.inputs[4].values
|
|
39
|
-
bn_eps = bn_node.attrs
|
|
39
|
+
bn_eps = bn_node.attrs.get("epsilon", 1.0e-5)
|
|
40
40
|
|
|
41
41
|
if len(conv_transpose_node.inputs) == 2:
|
|
42
42
|
conv_transpose_bias = np.zeros_like(bn_running_mean)
|
|
43
43
|
else:
|
|
44
44
|
conv_transpose_bias = conv_transpose_node.inputs[2].values
|
|
45
45
|
|
|
46
|
-
bn_var_rsqrt =
|
|
46
|
+
bn_var_rsqrt = bn_scale / np.sqrt(bn_running_var + bn_eps)
|
|
47
47
|
shape = [1] * len(conv_transpose_weight.shape)
|
|
48
48
|
if bn_node.i(0).op == "Conv":
|
|
49
49
|
shape[0] = -1
|
|
50
50
|
else:
|
|
51
51
|
shape[1] = -1
|
|
52
|
-
conv_w = conv_transpose_weight *
|
|
53
|
-
conv_b = (conv_transpose_bias - bn_running_mean) * bn_var_rsqrt
|
|
52
|
+
conv_w = conv_transpose_weight * bn_var_rsqrt.reshape(shape)
|
|
53
|
+
conv_b = (conv_transpose_bias - bn_running_mean) * bn_var_rsqrt + bn_bias
|
|
54
54
|
|
|
55
55
|
inputs = []
|
|
56
56
|
inputs.append(next(iter(conv_transpose_node.inputs)))
|
|
@@ -359,6 +359,7 @@ class SymbolicShapeInference:
|
|
|
359
359
|
for i in self.out_mp_.graph.initializer
|
|
360
360
|
}
|
|
361
361
|
)
|
|
362
|
+
self.known_vi_.update({i.name: i for i in list(self.out_mp_.graph.output)})
|
|
362
363
|
|
|
363
364
|
def _merge_symbols(self, dims):
|
|
364
365
|
"""Merge dimension symbols, handling automatic merging and validation of symbolic dimensions."""
|
|
@@ -582,9 +583,13 @@ class SymbolicShapeInference:
|
|
|
582
583
|
for i_o in range(len(node.output)):
|
|
583
584
|
o = node.output[i_o]
|
|
584
585
|
if o: # skip optional output
|
|
586
|
+
out = model.graph.output[i_o]
|
|
587
|
+
if not out.type.WhichOneof("value") and o in self.known_vi_: # if empty and already had
|
|
588
|
+
continue
|
|
589
|
+
|
|
585
590
|
vi = self.out_mp_.graph.value_info.add()
|
|
586
591
|
if not skip_infer:
|
|
587
|
-
vi.CopyFrom(
|
|
592
|
+
vi.CopyFrom(out)
|
|
588
593
|
else:
|
|
589
594
|
vi.name = o
|
|
590
595
|
self.known_vi_[o] = vi
|
|
@@ -1844,7 +1849,7 @@ class SymbolicShapeInference:
|
|
|
1844
1849
|
scales = self._try_get_value(node, 2)
|
|
1845
1850
|
sizes = self._try_get_value(node, 3)
|
|
1846
1851
|
if sizes is not None:
|
|
1847
|
-
new_sympy_shape = [sympy.simplify(
|
|
1852
|
+
new_sympy_shape = [sympy.simplify(round(s)) for s in sizes]
|
|
1848
1853
|
self._update_computed_dims(new_sympy_shape)
|
|
1849
1854
|
elif scales is not None:
|
|
1850
1855
|
rank = len(scales)
|
|
@@ -1860,7 +1865,7 @@ class SymbolicShapeInference:
|
|
|
1860
1865
|
else:
|
|
1861
1866
|
scales = list(scales)
|
|
1862
1867
|
new_sympy_shape = [
|
|
1863
|
-
(
|
|
1868
|
+
(round(d * (end - start) * scale))
|
|
1864
1869
|
for d, start, end, scale in zip(input_sympy_shape, roi_start, roi_end, scales)
|
|
1865
1870
|
]
|
|
1866
1871
|
self._update_computed_dims(new_sympy_shape)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.76"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onnxslim
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.76
|
|
4
4
|
Summary: OnnxSlim: A Toolkit to Help Optimize Onnx Model
|
|
5
5
|
Home-page: https://github.com/inisis/OnnxSlim
|
|
6
6
|
Author: inisis
|
|
@@ -15,7 +15,7 @@ Requires-Python: >=3.6
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: onnx
|
|
18
|
-
Requires-Dist: sympy>=1.13.
|
|
18
|
+
Requires-Dist: sympy>=1.13.1
|
|
19
19
|
Requires-Dist: packaging
|
|
20
20
|
Requires-Dist: colorama
|
|
21
21
|
Requires-Dist: ml_dtypes
|
|
@@ -36,7 +36,7 @@ Dynamic: summary
|
|
|
36
36
|
|
|
37
37
|
<p align="center">
|
|
38
38
|
<a href="https://pypi.org/project/onnxslim">
|
|
39
|
-
<img src="https://
|
|
39
|
+
<img src="https://img.shields.io/pypi/v/onnxslim?color=blue" />
|
|
40
40
|
</a>
|
|
41
41
|
<a href="https://pypi.org/project/onnxslim">
|
|
42
42
|
<img src="https://static.pepy.tech/badge/onnxslim/week" />
|
|
@@ -131,6 +131,7 @@ For more usage, see onnxslim -h or refer to our [examples](./examples)
|
|
|
131
131
|
- <img src="https://avatars.githubusercontent.com/u/126587470?s=48&v=4" width="22" height="22"/>[deepghs/imgutils](https://github.com/deepghs/imgutils)
|
|
132
132
|
- <img src="https://avatars.githubusercontent.com/u/48153283?s=48&v=4" width="22" height="22"/>[sunsmarterjie/yolov12](https://github.com/sunsmarterjie/yolov12)
|
|
133
133
|
- <img src="https://avatars.githubusercontent.com/u/147458884?s=48&v=4" width="22" height="22"/>[nndeploy/nndeploy](https://github.com/nndeploy/nndeploy)
|
|
134
|
+
- <img src="https://avatars.githubusercontent.com/u/111754012?s=48&v=4" width="22" height="22"/>[CVCUDA/CV-CUDA](https://github.com/CVCUDA/CV-CUDA)
|
|
134
135
|
|
|
135
136
|
# References
|
|
136
137
|
|
|
@@ -25,7 +25,7 @@ setup(
|
|
|
25
25
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
26
26
|
],
|
|
27
27
|
license="MIT",
|
|
28
|
-
install_requires=["onnx", "sympy>=1.13.
|
|
28
|
+
install_requires=["onnx", "sympy>=1.13.1", "packaging", "colorama", "ml_dtypes"],
|
|
29
29
|
packages=find_packages(exclude=("tests", "tests.*")),
|
|
30
30
|
entry_points={"console_scripts": ["onnxslim=onnxslim.cli:main"]},
|
|
31
31
|
zip_safe=True,
|
onnxslim-0.1.74/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.74
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.74"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/exporters/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/graph_pattern/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/importers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/logger/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxslim-0.1.74 → onnxslim-0.1.76}/onnxslim/third_party/onnx_graphsurgeon/util/exception.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|